New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
怎么设置柱状图柱子之间的距离为固定距离?paddingOuter 是什么意思?为什么范围是【0,1】? #6098
Comments
chart.interval()
.data(data)
.encode('x', 'year')
.encode('y', 'sales')
.scale('x', { paddingOuter: 0.1, paddingInner: 0.3 }); |
@hustcc 试了没有用啊,怎么设置柱子是 40px 柱子之间是60 啊 |
只能 0-1 百分比设置,按照像素的话,需要通过画布大小,数据数量,计算出这个百分比。 |
@hustcc 产品是这么设计的,柱子宽40px,两个柱子之间距离是 60px,能显示下就显示,显示不下x轴就出现 scrollbar,这能做到吗? |
@hustcc 设置了 scrollbar,柱子是 40px,设置 .scale('x', { paddingInner: 0.4}) 不起作用 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
问题描述
怎么设置柱状图柱子之间的距离为固定距离?paddingOuter 好像不起作用,paddingOuter 的范围为啥是【0,1】是按照谁的百分比吗?根本没有对应的文档啊重现链接
No response
重现步骤
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().data(data).encode('x', 'year')
.encode('y', 'sales')
.style('maxWidth', 40)
.style('minWidth', 40)
.interaction('elementHighlightByColor', { background: true })
.scale('x', { paddingOuter: 0.5 })
chart.render();
预期行为
No response
平台
屏幕截图或视频(可选)
No response
补充说明(可选)
No response
The text was updated successfully, but these errors were encountered: