@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
|
@@ -111,7 +111,7 @@ function getVisibleLabels(xTicks, {
|
|
|
111
111
|
return true;
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
|
-
function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
114
|
+
function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelStyle) {
|
|
115
115
|
const shortenedLabels = new Map();
|
|
116
116
|
const angle = clampAngle(tickLabelStyle?.angle ?? 0);
|
|
117
117
|
|
|
@@ -132,6 +132,9 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
|
132
132
|
if (angle > 90 && angle < 270) {
|
|
133
133
|
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
134
134
|
}
|
|
135
|
+
if (isRtl) {
|
|
136
|
+
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
137
|
+
}
|
|
135
138
|
for (const item of visibleLabels) {
|
|
136
139
|
if (item.formattedValue) {
|
|
137
140
|
// That maximum width of the tick depends on its proximity to the axis bounds.
|
|
@@ -293,7 +296,7 @@ function ChartsXAxis(inProps) {
|
|
|
293
296
|
|
|
294
297
|
/* If there's an axis title, the tick labels have less space to render */
|
|
295
298
|
const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
296
|
-
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
299
|
+
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
297
300
|
return /*#__PURE__*/_jsxs(XAxisRoot, {
|
|
298
301
|
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
299
302
|
className: classes.root,
|
|
@@ -9,6 +9,9 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { useThemeProps, styled, useTheme } from '@mui/material/styles';
|
|
11
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
|
+
import { useIsHydrated } from "../hooks/useIsHydrated.js";
|
|
13
|
+
import { getDefaultBaseline, getDefaultTextAnchor } from "../ChartsText/defaultTextPlacement.js";
|
|
14
|
+
import { doesTextFitInRect, ellipsize } from "../internals/ellipsize.js";
|
|
12
15
|
import { getStringSize } from "../internals/domUtils.js";
|
|
13
16
|
import { useTicks } from "../hooks/useTicks.js";
|
|
14
17
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
@@ -19,6 +22,8 @@ import { isInfinity } from "../internals/isInfinity.js";
|
|
|
19
22
|
import { isBandScale } from "../internals/isBandScale.js";
|
|
20
23
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
21
24
|
import { useYAxes } from "../hooks/index.js";
|
|
25
|
+
import { clampAngle } from "../internals/clampAngle.js";
|
|
26
|
+
import { invertTextAnchor } from "../internals/invertTextAnchor.js";
|
|
22
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
28
|
const useUtilityClasses = ownerState => {
|
|
24
29
|
const {
|
|
@@ -35,6 +40,47 @@ const useUtilityClasses = ownerState => {
|
|
|
35
40
|
};
|
|
36
41
|
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
37
42
|
};
|
|
43
|
+
|
|
44
|
+
/* Gap between a tick and its label. */
|
|
45
|
+
const TICK_LABEL_GAP = 2;
|
|
46
|
+
/* Gap between the axis label and tick labels. */
|
|
47
|
+
const AXIS_LABEL_TICK_LABEL_GAP = 2;
|
|
48
|
+
function shortenLabels(visibleLabels, drawingArea, maxWidth, isRtl, tickLabelStyle) {
|
|
49
|
+
const shortenedLabels = new Map();
|
|
50
|
+
const angle = clampAngle(tickLabelStyle?.angle ?? 0);
|
|
51
|
+
let topBoundFactor = 1;
|
|
52
|
+
let bottomBoundFactor = 1;
|
|
53
|
+
if (tickLabelStyle?.textAnchor === 'start') {
|
|
54
|
+
topBoundFactor = Infinity;
|
|
55
|
+
bottomBoundFactor = 1;
|
|
56
|
+
} else if (tickLabelStyle?.textAnchor === 'end') {
|
|
57
|
+
topBoundFactor = 1;
|
|
58
|
+
bottomBoundFactor = Infinity;
|
|
59
|
+
} else {
|
|
60
|
+
topBoundFactor = 2;
|
|
61
|
+
bottomBoundFactor = 2;
|
|
62
|
+
}
|
|
63
|
+
if (angle > 180) {
|
|
64
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
65
|
+
}
|
|
66
|
+
if (isRtl) {
|
|
67
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
68
|
+
}
|
|
69
|
+
for (const item of visibleLabels) {
|
|
70
|
+
if (item.formattedValue) {
|
|
71
|
+
// That maximum height of the tick depends on its proximity to the axis bounds.
|
|
72
|
+
const height = Math.min((item.offset + item.labelOffset) * topBoundFactor, (drawingArea.top + drawingArea.height + drawingArea.bottom - item.offset - item.labelOffset) * bottomBoundFactor);
|
|
73
|
+
const doesTextFit = text => doesTextFitInRect(text, {
|
|
74
|
+
width: maxWidth,
|
|
75
|
+
height,
|
|
76
|
+
angle,
|
|
77
|
+
measureText: string => getStringSize(string, tickLabelStyle)
|
|
78
|
+
});
|
|
79
|
+
shortenedLabels.set(item, ellipsize(item.formattedValue.toString(), doesTextFit));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return shortenedLabels;
|
|
83
|
+
}
|
|
38
84
|
const YAxisRoot = styled(AxisRoot, {
|
|
39
85
|
name: 'MuiChartsYAxis',
|
|
40
86
|
slot: 'Root',
|
|
@@ -92,16 +138,18 @@ function ChartsYAxis(inProps) {
|
|
|
92
138
|
} = defaultizedProps;
|
|
93
139
|
const theme = useTheme();
|
|
94
140
|
const isRtl = useRtl();
|
|
141
|
+
const isHydrated = useIsHydrated();
|
|
95
142
|
const classes = useUtilityClasses(defaultizedProps);
|
|
96
143
|
const {
|
|
97
144
|
instance
|
|
98
145
|
} = useChartContext();
|
|
146
|
+
const drawingArea = useDrawingArea();
|
|
99
147
|
const {
|
|
100
148
|
left,
|
|
101
149
|
top,
|
|
102
150
|
width,
|
|
103
151
|
height
|
|
104
|
-
} =
|
|
152
|
+
} = drawingArea;
|
|
105
153
|
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
106
154
|
const yTicks = useTicks({
|
|
107
155
|
scale: yScale,
|
|
@@ -117,15 +165,16 @@ function ChartsYAxis(inProps) {
|
|
|
117
165
|
const Tick = slots?.axisTick ?? 'line';
|
|
118
166
|
const TickLabel = slots?.axisTickLabel ?? ChartsText;
|
|
119
167
|
const Label = slots?.axisLabel ?? ChartsText;
|
|
120
|
-
const
|
|
168
|
+
const defaultTextAnchor = getDefaultTextAnchor((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
169
|
+
const defaultDominantBaseline = getDefaultBaseline((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
121
170
|
const axisTickLabelProps = useSlotProps({
|
|
122
171
|
elementType: TickLabel,
|
|
123
172
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
124
173
|
additionalProps: {
|
|
125
174
|
style: _extends({}, theme.typography.caption, {
|
|
126
175
|
fontSize: tickFontSize,
|
|
127
|
-
textAnchor:
|
|
128
|
-
dominantBaseline:
|
|
176
|
+
textAnchor: isRtl ? invertTextAnchor(defaultTextAnchor) : defaultTextAnchor,
|
|
177
|
+
dominantBaseline: defaultDominantBaseline
|
|
129
178
|
}, tickLabelStyle)
|
|
130
179
|
},
|
|
131
180
|
className: classes.tickLabel,
|
|
@@ -140,7 +189,7 @@ function ChartsYAxis(inProps) {
|
|
|
140
189
|
fontSize: 14,
|
|
141
190
|
angle: positionSign * 90,
|
|
142
191
|
textAnchor: 'middle',
|
|
143
|
-
dominantBaseline: '
|
|
192
|
+
dominantBaseline: 'text-before-edge'
|
|
144
193
|
}, labelStyle)
|
|
145
194
|
},
|
|
146
195
|
ownerState: {}
|
|
@@ -163,11 +212,13 @@ function ChartsYAxis(inProps) {
|
|
|
163
212
|
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity) || position === 'none') {
|
|
164
213
|
return null;
|
|
165
214
|
}
|
|
166
|
-
const labelHeight = label ? getStringSize(label, axisLabelProps.style).height : 0;
|
|
167
215
|
const labelRefPoint = {
|
|
168
|
-
x: positionSign *
|
|
216
|
+
x: positionSign * axisWidth,
|
|
169
217
|
y: top + height / 2
|
|
170
218
|
};
|
|
219
|
+
/* If there's an axis title, the tick labels have less space to render */
|
|
220
|
+
const tickLabelsMaxWidth = Math.max(0, axisWidth - (label ? getStringSize(label, axisLabelProps.style).height + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
221
|
+
const tickLabels = isHydrated ? shortenLabels(yTicks, drawingArea, tickLabelsMaxWidth, isRtl, axisTickLabelProps.style) : new Map(Array.from(yTicks).map(item => [item, item.formattedValue]));
|
|
171
222
|
return /*#__PURE__*/_jsxs(YAxisRoot, {
|
|
172
223
|
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
173
224
|
className: classes.root,
|
|
@@ -176,13 +227,13 @@ function ChartsYAxis(inProps) {
|
|
|
176
227
|
y1: top,
|
|
177
228
|
y2: top + height,
|
|
178
229
|
className: classes.line
|
|
179
|
-
}, lineSlotProps)), yTicks.map(({
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const xTickLabel = positionSign * (tickSize +
|
|
230
|
+
}, lineSlotProps)), yTicks.map((item, index) => {
|
|
231
|
+
const {
|
|
232
|
+
offset: tickOffset,
|
|
233
|
+
labelOffset,
|
|
234
|
+
value
|
|
235
|
+
} = item;
|
|
236
|
+
const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
186
237
|
const yTickLabel = labelOffset;
|
|
187
238
|
const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
|
|
188
239
|
const showLabel = instance.isPointInside({
|
|
@@ -191,6 +242,7 @@ function ChartsYAxis(inProps) {
|
|
|
191
242
|
}, {
|
|
192
243
|
direction: 'y'
|
|
193
244
|
});
|
|
245
|
+
const tickLabel = tickLabels.get(item);
|
|
194
246
|
if (!showLabel) {
|
|
195
247
|
return null;
|
|
196
248
|
}
|
|
@@ -200,13 +252,13 @@ function ChartsYAxis(inProps) {
|
|
|
200
252
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
201
253
|
x2: positionSign * tickSize,
|
|
202
254
|
className: classes.tick
|
|
203
|
-
}, slotProps?.axisTick)),
|
|
255
|
+
}, slotProps?.axisTick)), tickLabel !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
204
256
|
x: xTickLabel,
|
|
205
257
|
y: yTickLabel,
|
|
206
|
-
text:
|
|
258
|
+
text: tickLabel
|
|
207
259
|
}, axisTickLabelProps))]
|
|
208
260
|
}, index);
|
|
209
|
-
}), label && /*#__PURE__*/_jsx("g", {
|
|
261
|
+
}), label && isHydrated && /*#__PURE__*/_jsx("g", {
|
|
210
262
|
className: classes.label,
|
|
211
263
|
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
212
264
|
text: label
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
9
|
-
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
8
|
+
import { useAnimateArea } from "../hooks/animation/useAnimateArea.js";
|
|
10
9
|
import { AppearingMask } from "./AppearingMask.js";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
@@ -21,38 +20,22 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
20
|
*/
|
|
22
21
|
function AnimatedArea(props) {
|
|
23
22
|
const {
|
|
24
|
-
d,
|
|
25
23
|
skipAnimation,
|
|
26
24
|
ownerState
|
|
27
25
|
} = props,
|
|
28
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
const
|
|
30
|
-
const transitionChange = useTransition([stringInterpolator], {
|
|
31
|
-
from: skipAnimation ? undefined : {
|
|
32
|
-
value: 0
|
|
33
|
-
},
|
|
34
|
-
to: {
|
|
35
|
-
value: 1
|
|
36
|
-
},
|
|
37
|
-
enter: {
|
|
38
|
-
value: 1
|
|
39
|
-
},
|
|
40
|
-
reset: false,
|
|
41
|
-
immediate: skipAnimation
|
|
42
|
-
});
|
|
27
|
+
const animatedProps = useAnimateArea(props);
|
|
43
28
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
44
29
|
skipAnimation: skipAnimation,
|
|
45
30
|
id: `${ownerState.id}-area-clip`,
|
|
46
|
-
children:
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
d: style.value.to(interpolator),
|
|
31
|
+
children: /*#__PURE__*/_jsx("path", _extends({
|
|
49
32
|
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
50
33
|
filter:
|
|
51
34
|
// eslint-disable-next-line no-nested-ternary
|
|
52
35
|
ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
|
|
53
36
|
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
54
37
|
stroke: "none"
|
|
55
|
-
}, other))
|
|
38
|
+
}, other, animatedProps))
|
|
56
39
|
});
|
|
57
40
|
}
|
|
58
41
|
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 };
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
9
|
-
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
8
|
+
import { useAnimateLine } from "../hooks/index.js";
|
|
10
9
|
import { AppearingMask } from "./AppearingMask.js";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
@@ -19,42 +18,28 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
19
18
|
*
|
|
20
19
|
* - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
|
|
21
20
|
*/
|
|
22
|
-
function AnimatedLine(props) {
|
|
21
|
+
const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props, ref) {
|
|
23
22
|
const {
|
|
24
|
-
d,
|
|
25
23
|
skipAnimation,
|
|
26
24
|
ownerState
|
|
27
25
|
} = props,
|
|
28
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value: 0
|
|
33
|
-
},
|
|
34
|
-
to: {
|
|
35
|
-
value: 1
|
|
36
|
-
},
|
|
37
|
-
enter: {
|
|
38
|
-
value: 1
|
|
39
|
-
},
|
|
40
|
-
reset: false,
|
|
41
|
-
immediate: skipAnimation
|
|
42
|
-
});
|
|
27
|
+
const animateProps = useAnimateLine(_extends({}, props, {
|
|
28
|
+
ref
|
|
29
|
+
}));
|
|
43
30
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
44
31
|
skipAnimation: skipAnimation,
|
|
45
32
|
id: `${ownerState.id}-line-clip`,
|
|
46
|
-
children:
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
d: style.value.to(interpolator),
|
|
33
|
+
children: /*#__PURE__*/_jsx("path", _extends({
|
|
49
34
|
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
50
35
|
strokeWidth: 2,
|
|
51
36
|
strokeLinejoin: "round",
|
|
52
37
|
fill: "none",
|
|
53
38
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
54
39
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
55
|
-
}, other))
|
|
40
|
+
}, other, animateProps))
|
|
56
41
|
});
|
|
57
|
-
}
|
|
42
|
+
});
|
|
58
43
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
59
44
|
// ----------------------------- Warning --------------------------------
|
|
60
45
|
// | 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,40 +1,45 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
|
|
5
8
|
import { cleanId } from "../internals/cleanId.js";
|
|
6
9
|
import { useChartId, useDrawingArea } from "../hooks/index.js";
|
|
7
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export const appearingMaskClasses = generateUtilityClasses('MuiAppearingMask', ['animate']);
|
|
12
|
+
const AnimatedRect = styled('rect')({
|
|
13
|
+
animationName: 'animate-width',
|
|
14
|
+
animationTimingFunction: ANIMATION_TIMING_FUNCTION,
|
|
15
|
+
animationDuration: '0s',
|
|
16
|
+
[`&.${appearingMaskClasses.animate}`]: {
|
|
17
|
+
animationDuration: `${ANIMATION_DURATION_MS}ms`
|
|
18
|
+
},
|
|
19
|
+
'@keyframes animate-width': {
|
|
20
|
+
from: {
|
|
21
|
+
width: 0
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
8
26
|
/**
|
|
9
27
|
* @ignore - internal component.
|
|
10
28
|
*/
|
|
11
29
|
export function AppearingMask(props) {
|
|
12
30
|
const drawingArea = useDrawingArea();
|
|
13
31
|
const chartId = useChartId();
|
|
14
|
-
const transitionAppear = useTransition([drawingArea], {
|
|
15
|
-
from: props.skipAnimation ? undefined : v => ({
|
|
16
|
-
animatedWidth: v.left
|
|
17
|
-
}),
|
|
18
|
-
enter: v => ({
|
|
19
|
-
animatedWidth: v.width + v.left + v.right
|
|
20
|
-
}),
|
|
21
|
-
leave: v => ({
|
|
22
|
-
animatedWidth: v.width + v.left + v.right
|
|
23
|
-
}),
|
|
24
|
-
reset: false,
|
|
25
|
-
immediate: props.skipAnimation
|
|
26
|
-
});
|
|
27
32
|
const clipId = cleanId(`${chartId}-${props.id}`);
|
|
28
33
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
29
34
|
children: [/*#__PURE__*/_jsx("clipPath", {
|
|
30
35
|
id: clipId,
|
|
31
|
-
children:
|
|
32
|
-
|
|
36
|
+
children: /*#__PURE__*/_jsx(AnimatedRect, {
|
|
37
|
+
className: clsx(!props.skipAnimation && appearingMaskClasses.animate),
|
|
33
38
|
x: 0,
|
|
34
39
|
y: 0,
|
|
35
|
-
width:
|
|
40
|
+
width: drawingArea.left + drawingArea.width + drawingArea.right,
|
|
36
41
|
height: drawingArea.top + drawingArea.height + drawingArea.bottom
|
|
37
|
-
})
|
|
42
|
+
})
|
|
38
43
|
}), /*#__PURE__*/_jsx("g", {
|
|
39
44
|
clipPath: `url(#${clipId})`,
|
|
40
45
|
children: props.children
|
|
@@ -5,15 +5,23 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import { useTheme } from '@mui/material/styles';
|
|
9
|
-
import {
|
|
8
|
+
import { styled, useTheme } from '@mui/material/styles';
|
|
9
|
+
import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
|
|
10
10
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
11
11
|
import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
|
|
12
|
-
import { useUtilityClasses } from "./markElementClasses.js";
|
|
12
|
+
import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
|
|
13
13
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
14
|
-
import {
|
|
14
|
+
import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
15
15
|
import { useStore } from "../internals/store/useStore.js";
|
|
16
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
const Circle = styled('circle')({
|
|
18
|
+
[`&.${markElementClasses.animate}`]: {
|
|
19
|
+
transitionDuration: `${ANIMATION_DURATION_MS}ms`,
|
|
20
|
+
transitionProperty: 'cx, cy',
|
|
21
|
+
transitionTimingFunction: ANIMATION_TIMING_FUNCTION
|
|
22
|
+
}
|
|
23
|
+
});
|
|
24
|
+
|
|
17
25
|
/**
|
|
18
26
|
* The line mark element that only render circle for performance improvement.
|
|
19
27
|
*
|
|
@@ -51,33 +59,19 @@ function CircleMarkElement(props) {
|
|
|
51
59
|
seriesId: id
|
|
52
60
|
});
|
|
53
61
|
const store = useStore();
|
|
54
|
-
const
|
|
55
|
-
const cx = useSpringValue(x, {
|
|
56
|
-
immediate: skipAnimation
|
|
57
|
-
});
|
|
58
|
-
const cy = useSpringValue(y, {
|
|
59
|
-
immediate: skipAnimation
|
|
60
|
-
});
|
|
61
|
-
React.useEffect(() => {
|
|
62
|
-
cy.start(y, {
|
|
63
|
-
immediate: skipAnimation
|
|
64
|
-
});
|
|
65
|
-
cx.start(x, {
|
|
66
|
-
immediate: skipAnimation
|
|
67
|
-
});
|
|
68
|
-
}, [cy, y, cx, x, skipAnimation]);
|
|
62
|
+
const xAxisInteractionIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
|
|
69
63
|
const ownerState = {
|
|
70
64
|
id,
|
|
71
65
|
classes: innerClasses,
|
|
72
|
-
isHighlighted:
|
|
66
|
+
isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
|
|
73
67
|
isFaded,
|
|
74
|
-
color
|
|
68
|
+
color,
|
|
69
|
+
skipAnimation
|
|
75
70
|
};
|
|
76
71
|
const classes = useUtilityClasses(ownerState);
|
|
77
|
-
return /*#__PURE__*/_jsx(
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
cy: cy,
|
|
72
|
+
return /*#__PURE__*/_jsx(Circle, _extends({}, other, {
|
|
73
|
+
cx: x,
|
|
74
|
+
cy: y,
|
|
81
75
|
r: 5,
|
|
82
76
|
fill: (theme.vars || theme).palette.background.paper,
|
|
83
77
|
stroke: color,
|
|
@@ -238,6 +238,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
238
238
|
height: PropTypes.number,
|
|
239
239
|
hideTooltip: PropTypes.bool,
|
|
240
240
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
|
+
ignoreTooltip: PropTypes.bool,
|
|
241
242
|
label: PropTypes.string,
|
|
242
243
|
labelStyle: PropTypes.object,
|
|
243
244
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -293,6 +294,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
293
294
|
fill: PropTypes.string,
|
|
294
295
|
hideTooltip: PropTypes.bool,
|
|
295
296
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
297
|
+
ignoreTooltip: PropTypes.bool,
|
|
296
298
|
label: PropTypes.string,
|
|
297
299
|
labelStyle: PropTypes.object,
|
|
298
300
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -13,7 +13,7 @@ import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
|
13
13
|
import { useLineSeriesContext } from "../hooks/useLineSeries.js";
|
|
14
14
|
import getColor from "./seriesConfig/getColor.js";
|
|
15
15
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
16
|
-
import {
|
|
16
|
+
import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
17
17
|
import { useXAxes, useYAxes } from "../hooks/useAxis.js";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
/**
|
|
@@ -45,9 +45,8 @@ function LineHighlightPlot(props) {
|
|
|
45
45
|
instance
|
|
46
46
|
} = useChartContext();
|
|
47
47
|
const store = useStore();
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
if (highlightedIndex === undefined) {
|
|
48
|
+
const highlightedIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
|
|
49
|
+
if (highlightedIndex === null) {
|
|
51
50
|
return null;
|
|
52
51
|
}
|
|
53
52
|
if (seriesData === undefined) {
|
|
@@ -7,16 +7,16 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
|
|
10
|
-
import {
|
|
10
|
+
import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
|
|
11
11
|
import { getSymbol } from "../internals/getSymbol.js";
|
|
12
12
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
13
|
import { useItemHighlighted } from "../hooks/useItemHighlighted.js";
|
|
14
|
-
import {
|
|
15
|
-
import {
|
|
14
|
+
import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
15
|
+
import { markElementClasses, useUtilityClasses } from "./markElementClasses.js";
|
|
16
16
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
17
17
|
import { useStore } from "../internals/store/useStore.js";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
-
const MarkElementPath = styled(
|
|
19
|
+
const MarkElementPath = styled('path', {
|
|
20
20
|
name: 'MuiMarkElement',
|
|
21
21
|
slot: 'Root',
|
|
22
22
|
overridesResolver: (_, styles) => styles.root
|
|
@@ -26,7 +26,12 @@ const MarkElementPath = styled(animated.path, {
|
|
|
26
26
|
}) => ({
|
|
27
27
|
fill: (theme.vars || theme).palette.background.paper,
|
|
28
28
|
stroke: ownerState.color,
|
|
29
|
-
strokeWidth: 2
|
|
29
|
+
strokeWidth: 2,
|
|
30
|
+
[`&.${markElementClasses.animate}`]: {
|
|
31
|
+
transitionDuration: `${ANIMATION_DURATION_MS}ms`,
|
|
32
|
+
transitionProperty: 'transform, transform-origin',
|
|
33
|
+
transitionTimingFunction: ANIMATION_TIMING_FUNCTION
|
|
34
|
+
}
|
|
30
35
|
}));
|
|
31
36
|
/**
|
|
32
37
|
* Demos:
|
|
@@ -63,37 +68,22 @@ function MarkElement(props) {
|
|
|
63
68
|
seriesId: id
|
|
64
69
|
});
|
|
65
70
|
const store = useStore();
|
|
66
|
-
const
|
|
67
|
-
const cx = useSpringValue(x, {
|
|
68
|
-
immediate: skipAnimation
|
|
69
|
-
});
|
|
70
|
-
const cy = useSpringValue(y, {
|
|
71
|
-
immediate: skipAnimation
|
|
72
|
-
});
|
|
73
|
-
React.useEffect(() => {
|
|
74
|
-
cy.start(y, {
|
|
75
|
-
immediate: skipAnimation
|
|
76
|
-
});
|
|
77
|
-
cx.start(x, {
|
|
78
|
-
immediate: skipAnimation
|
|
79
|
-
});
|
|
80
|
-
}, [cy, y, cx, x, skipAnimation]);
|
|
71
|
+
const xAxisInteractionIndex = useSelector(store, selectorChartsInteractionXAxisIndex);
|
|
81
72
|
const ownerState = {
|
|
82
73
|
id,
|
|
83
74
|
classes: innerClasses,
|
|
84
|
-
isHighlighted:
|
|
75
|
+
isHighlighted: xAxisInteractionIndex === dataIndex || isHighlighted,
|
|
85
76
|
isFaded,
|
|
86
|
-
color
|
|
77
|
+
color,
|
|
78
|
+
skipAnimation
|
|
87
79
|
};
|
|
88
80
|
const classes = useUtilityClasses(ownerState);
|
|
89
81
|
return /*#__PURE__*/_jsx(MarkElementPath, _extends({}, other, {
|
|
90
82
|
style: {
|
|
91
|
-
transform:
|
|
92
|
-
transformOrigin:
|
|
83
|
+
transform: `translate(${x}px, ${y}px)`,
|
|
84
|
+
transformOrigin: `${x}px ${y}px`
|
|
93
85
|
},
|
|
94
|
-
ownerState: ownerState
|
|
95
|
-
// @ts-expect-error
|
|
96
|
-
,
|
|
86
|
+
ownerState: ownerState,
|
|
97
87
|
className: classes.root,
|
|
98
88
|
d: d3Symbol(d3SymbolsFill[getSymbol(shape)])(),
|
|
99
89
|
onClick: onClick,
|
|
@@ -117,7 +107,6 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
|
117
107
|
shape: PropTypes.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired,
|
|
118
108
|
/**
|
|
119
109
|
* If `true`, animations are skipped.
|
|
120
|
-
* @default false
|
|
121
110
|
*/
|
|
122
111
|
skipAnimation: PropTypes.bool
|
|
123
112
|
} : void 0;
|
|
@@ -6,6 +6,8 @@ export interface MarkElementClasses {
|
|
|
6
6
|
highlighted: string;
|
|
7
7
|
/** Styles applied to the root element when faded. */
|
|
8
8
|
faded: string;
|
|
9
|
+
/** Styles applied to the root element when animation is not skipped. */
|
|
10
|
+
animate: string;
|
|
9
11
|
}
|
|
10
12
|
export type MarkElementClassKey = keyof MarkElementClasses;
|
|
11
13
|
export interface MarkElementOwnerState {
|
|
@@ -14,6 +16,7 @@ export interface MarkElementOwnerState {
|
|
|
14
16
|
isFaded: boolean;
|
|
15
17
|
isHighlighted: boolean;
|
|
16
18
|
classes?: Partial<MarkElementClasses>;
|
|
19
|
+
skipAnimation?: boolean;
|
|
17
20
|
}
|
|
18
21
|
export declare function getMarkElementUtilityClass(slot: string): string;
|
|
19
22
|
export declare const markElementClasses: MarkElementClasses;
|
|
@@ -4,16 +4,17 @@ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
|
4
4
|
export function getMarkElementUtilityClass(slot) {
|
|
5
5
|
return generateUtilityClass('MuiMarkElement', slot);
|
|
6
6
|
}
|
|
7
|
-
export const markElementClasses = generateUtilityClasses('MuiMarkElement', ['root', 'highlighted', 'faded']);
|
|
7
|
+
export const markElementClasses = generateUtilityClasses('MuiMarkElement', ['root', 'highlighted', 'faded', 'animate']);
|
|
8
8
|
export const useUtilityClasses = ownerState => {
|
|
9
9
|
const {
|
|
10
10
|
classes,
|
|
11
11
|
id,
|
|
12
12
|
isFaded,
|
|
13
|
-
isHighlighted
|
|
13
|
+
isHighlighted,
|
|
14
|
+
skipAnimation
|
|
14
15
|
} = ownerState;
|
|
15
16
|
const slots = {
|
|
16
|
-
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
17
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded', skipAnimation ? undefined : 'animate']
|
|
17
18
|
};
|
|
18
19
|
return composeClasses(slots, getMarkElementUtilityClass, classes);
|
|
19
20
|
};
|