echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Bug] yAxis axisLabel width

Open tiansial opened this issue 1 year ago • 1 comments

Version

5.5.1

Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/agitated-nova-hrm3w5?file=%2Fsrc%2FApp.js%3A10%2C18

Steps to Reproduce

If I have multiple charts stacked vertically with the same X-axis and different Y-axis values, the charts won't be aligned due to the other Y-axis width. I'm using https://echarts.apache.org/en/option.html#yAxis.axisLabel.width to manually set a specific width on all the charts, but I'm not getting the expected behaviour. image

Current Behavior

yAxis axisLabel width does not respect https://echarts.apache.org/en/option.html#yAxis.axisLabel.width

Expected Behavior

yAxis axisLabel should be set width https://echarts.apache.org/en/option.html#yAxis.axisLabel.width

Environment

- OS: macOS 15.0.1 
- Browser: Chrome 129.0.6668.91
- Framework: Remix

Any additional comments?

No response

tiansial avatar Oct 15 '24 11:10 tiansial

have you tried grid with axis sync, or connect ?

helgasoft avatar Oct 15 '24 16:10 helgasoft

The position of the yAxis is decided by grid.left. You can set it to be larger to avoid axis labels being clipped. You may dynimically calculate the left value based on the length of the data. For example: left: data.reduce((a, b) => Math.max((a + '').length, (b + '').length), 1) * 5 + 30.

Ovilia avatar Oct 28 '24 10:10 Ovilia

我用了这种写法还是对不齐,对齐得把containLabel设置成false

7hao123 avatar Jan 14 '25 01:01 7hao123