From 1422365e104b630b4efebb919e27f4b7321a1449 Mon Sep 17 00:00:00 2001 From: Robin Gerling Date: Mon, 29 Jan 2024 12:18:22 +0100 Subject: [PATCH] fix(grid) Simplify default rotation computation of y-axis. close #9265 --- src/coord/axisHelper.ts | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/coord/axisHelper.ts b/src/coord/axisHelper.ts index 2e40674021..b1707c96ef 100644 --- a/src/coord/axisHelper.ts +++ b/src/coord/axisHelper.ts @@ -352,9 +352,7 @@ export function computeNameBoundingRect(axis: Axis2D): BoundingRect { } const axisLabelModel = axisModel.getModel('nameTextStyle'); const unRotatedNameBoundingRect = axisLabelModel.getTextRect(axisModel.getModel('name').option); - const defaultRotationYAxis = (axisModel.get('nameLocation') === 'end' || axisModel.get('nameLocation') === 'start') - && !axis.isHorizontal() ? 0 : -90; - const defaultRotation = axis.dim === 'x' ? 0 : defaultRotationYAxis; + const defaultRotation = axis.isHorizontal() || !isNameLocationCenter(axisModel.get('nameLocation')) ? 0 : -90; const rotatedNameBoundingRect = rotateTextRect( unRotatedNameBoundingRect, axisModel.getModel('nameRotate').option ?? defaultRotation );