fix(图表): 修复柱条图轴线标签自动旋转

This commit is contained in:
wisonic-s
2025-11-17 16:41:17 +08:00
committed by wisonic-s
parent d16236a82d
commit 369d3a03d1
3 changed files with 3 additions and 22 deletions

View File

@@ -600,13 +600,6 @@ export class Bar extends G2ChartView<ViewSpec, G2Column> {
return value
}
}
// 刻度值旋转角度
const rotate = axis.axisLabel.rotate
const labelTransform = {
type: 'rotate',
optionalAngles: !rotate || rotate === 0 ? [] : [rotate],
recoverWhenFailed: false
}
const x = {
position: axis.position,
// 标题
@@ -623,7 +616,7 @@ export class Bar extends G2ChartView<ViewSpec, G2Column> {
...label,
labelAutoHide: true,
labelAutoRotate: false,
...(rotate === 0 ? {} : { transform: [labelTransform] })
labelTransform: `rotate(${axis.axisLabel.rotate || 0})`
}
return x
}

View File

@@ -330,11 +330,6 @@ export class BulletGraph extends G2ChartView<RuntimeOptions, G2Bullet> {
return value
}
}
// 刻度值旋转角度
const labelTransform = {
type: 'rotate',
optionalAngles: [axis.axisLabel.rotate]
}
const x = {
// 标题
title: axis.nameShow && axis.name ? axis.name : false,
@@ -348,7 +343,7 @@ export class BulletGraph extends G2ChartView<RuntimeOptions, G2Bullet> {
...grid,
// 刻度值
...label,
transform: [labelTransform]
labelTransform: `rotate(${axis.axisLabel.rotate || 0})`
}
return x
}

View File

@@ -214,13 +214,6 @@ export class HorizontalBar extends Bar {
return value
}
}
// 刻度值旋转角度
const rotate = axis.axisLabel.rotate
const labelTransform = {
type: 'rotate',
optionalAngles: !rotate || rotate === 0 ? [] : [rotate],
recoverWhenFailed: false
}
const x = {
position: axis.position,
// 标题
@@ -237,7 +230,7 @@ export class HorizontalBar extends Bar {
...label,
labelAutoHide: true,
labelAutoRotate: false,
...(rotate === 0 ? {} : { transform: [labelTransform] })
labelTransform: `rotate(${axis.axisLabel.rotate || 0})`
}
return x
}