Skip to content
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

可以让x轴固定不偏移吗 #3989

Closed
1 task
Dawnwangzi opened this issue Jun 17, 2022 · 1 comment
Closed
1 task

可以让x轴固定不偏移吗 #3989

Dawnwangzi opened this issue Jun 17, 2022 · 1 comment

Comments

@Dawnwangzi
Copy link

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

https://g2.antv.vision/zh/examples/line/basic#curved

Steps to reproduce

Environment Info
g2 4.2.3
System -
Browser -

  • 能理解因为y轴的数值是发生变化了的,所以x轴被挤了一下有平移,但是可不可以把y轴位置固定住,不让发生数值较大变化的时候有轴的偏移呢?
  • 期望能把轴固定住不动,给y轴左侧文字留一个固定大小的位置或者y轴超过一定宽度了之后再去压图的大小
@hustcc
Copy link
Member

hustcc commented Jun 22, 2022

const chart = new Chart({
  container: 'container',
  autoFit: true,
  height: 500,
  padding: [0, 50, 50, 50], // 这里 「上右下左」
});

不设置 padding 的时候,padding 是自动根据四周的组件大小计算的,所以数值大的时候,y 轴占用宽,所以 x 轴有一些偏移,只要固定左侧边距就可以了。

@hustcc hustcc closed this as completed Jun 22, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants