柱状图转换坐标系后如何让标签文字也进行旋转 #6280
Unanswered
juanhuang99
asked this question in
Q&A
Replies: 1 comment
-
试试这样:chart.axis('x', { labelTransform: 'rotate(90deg)' }) |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
问题描述
代码如下:
import { Chart } from '@antv/g2';
const data = [
{ year: '1951 年', sales: 38 },
{ year: '1952 年', sales: 52 },
{ year: '1956 年', sales: 61 },
{ year: '1957 年', sales: 145 },
{ year: '1958 年', sales: 48 },
{ year: '1959 年', sales: 38 },
{ year: '1960 年', sales: 38 },
{ year: '1962 年', sales: 38 },
];
const chart = new Chart({
container: 'container',
autoFit: true,
});
chart
.interval()
.coordinate({ transform: [{ type: 'transpose' }] })
.data(data)
.encode('x', 'year')
.encode('y', 'sales');
chart.render();
坐标转换之后,如何能让文字也进行旋转,如图所示:
重现链接
No response
重现步骤
No response
预期行为
No response
平台
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
Beta Was this translation helpful? Give feedback.
All reactions