echarts icon indicating copy to clipboard operation
echarts copied to clipboard

[Feature] Align multiple Y Axis 0 line

Open jack-chui opened this issue 4 years ago • 14 comments

What problem does this feature solve?

I read the API document but I cannot see a method to align 0 line for different Y Axis Capture .

What does the proposed API look like?

Any method can help me to align different 0 line in Y axis?

jack-chui avatar Dec 01 '21 09:12 jack-chui

I would like to know this as well

mdhxolta avatar Dec 02 '21 07:12 mdhxolta

@pissang Shouldn't the new option alignTicks address this ?

ThomasKientz avatar Feb 11 '22 20:02 ThomasKientz

alignTicks aligns the ticks that they are on top of each other but it is not value specific. That the 0 is aligned to the other 0 is not given if there are negative numbers.

A second option to manually align values to values wood be good. Or is there a point I'm missing?

In my example the 0s can't be aligned via alignTicks if the sides have not the same proportions. Imgur

Daraan avatar Apr 30 '22 12:04 Daraan

If you set the min and max values, the 0 line will be displayed correctly. I have calculated the min and max values of all Y axes on the basis of the data and passed them in the options.

I hope that helps a little bit.

Superkarl avatar May 31 '22 09:05 Superkarl

Hey! Any updates on this one?

API proposal

yAxis.alignValues: number - Aligns ticks with the passed value on multiple numeric y axes. Only available for axes of type 'value' or log.

Or, as this probably is only needed to align 0 values, yAxis.alignZero: boolean - Aligns ticks with the 0 value on multiple numeric y axes. Only available for axes of type 'value' or log.

Geloosa avatar Jul 19 '23 15:07 Geloosa

@Superkarl

Unfortunately, this does not solve my issue. My values on the first axis have amounts of millions and my second axis' values have cents. Setting a Min value leads to unseeable/unnoticeable chart elements (e.g. super small bars) for elements on my second axis.

Would be a really cool feature to align both axis on the 0-line, because the rest just looks odd to me (and my executives) :)

snibbo avatar Aug 04 '23 10:08 snibbo

After almost 3 years, this issue is still open. If someone from the team can address at least whether this will be addressed or not will help guide decisions as to charting library adoption. For reference, this is a highcharts implementation with 4 y axes all with different range(s)/min/max

UPDATE: A temporary/permanent workaround is https://github.com/apache/echarts/issues/18541

Pk13055 avatar Nov 09 '23 01:11 Pk13055

Hi, any updates on this issue?

agusdutra avatar Feb 29 '24 10:02 agusdutra

Hey team, please have a look, It should be possible to do

oneart-dev avatar Mar 04 '24 17:03 oneart-dev

I think the problem is on the alignScaleTicks function added in this PR https://github.com/apache/echarts/pull/16300

@pissang since you implemented, would you have some light on how to fix this? I've tried to get around it but I'm not familiar with the implementation of the library.

Thanks

agusdutra avatar Mar 13 '24 05:03 agusdutra

Any updates on this one? just like alignZero: boolean

Rookior avatar Jun 19 '24 06:06 Rookior

This would definitely be useful...!

bertrandgorge avatar Aug 27 '24 07:08 bertrandgorge

Just recently started using echarts and would like this feature very much because sometimes one of my y-axis can be less than zero, the other though is always either 0 or above and therefore the graph looks a bit wonky when the one side is negative. alignZero: boolean would help me very much!

0x0054 avatar Mar 31 '25 05:03 0x0054

see #18541 for possible solution

helgasoft avatar May 30 '25 06:05 helgasoft

1+ same issue

soulincsl avatar Oct 27 '25 04:10 soulincsl