antvis/G2

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

Dawnwangzi posted onGitHub

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

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轴超过一定宽度了之后再去压图的大小

<!-- generated by antv-issue-helper. DO NOT REMOVE -->


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

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

posted by hustcc almost 3 years ago

Fund this Issue

$0.00
Funded

Pull requests