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

Is it possible to put the y-axis both left and right? #11589

Closed
mglimmerveen opened this issue Nov 7, 2019 · 10 comments
Closed

Is it possible to put the y-axis both left and right? #11589

mglimmerveen opened this issue Nov 7, 2019 · 10 comments
Labels
en This issue is in English inactive Not active for some time or no response from the author. Will be closed soon. new-feature waiting-for: community

Comments

@mglimmerveen
Copy link

What problem does this feature solve?

We would like to have the y-axis of a chart (with only 1 y-axis) on both left and right. This way, the user would have more context about the value of the chart on the far end of the chart.

I have tried some workarounds, looked in the documentation and asked a question on StackOverflow , but I haven't been able to achieve this, other then completely duplicating the entire series, which is undesirable of course.

Hence, I think this is a feature request.

What does the proposed API look like?

The y-axis configuration already has a position property, which has the options 'left' and 'right'. Please add option 'both'.

@echarts-bot
Copy link

echarts-bot bot commented Nov 7, 2019

Hi! We've received your issue and please be patient to get responded. 🎉
The average response time is expected to be within one day for weekdays.

In the meanwhile, please make sure that you have posted enough image to demo your request. You may also check out the API and chart option to get the answer.

If you don't get helped for a long time (over a week) or have an urgent question to ask, you may also send an email to dev@echarts.apache.org. Please attach the issue link if it's a technical questions.

If you are interested in the project, you may also subscribe our mail list.

Have a nice day! 🍵

@echarts-bot echarts-bot bot added en This issue is in English new-feature pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Nov 7, 2019
@Ovilia
Copy link
Contributor

Ovilia commented Nov 8, 2019

So you want two axes on two sides, and they are the same?
You can set yAxis to be an array of y axes and max value should be set to make sure they are the same. Then, hide splitLine of the right axis.

@echarts-bot
Copy link

echarts-bot bot commented Nov 8, 2019

This issue is labeled with waiting-for: author.
@mglimmerveen Please give more information to get the help from the community, or close this issue if you think your problem has been fixed.

@mglimmerveen
Copy link
Author

So you want two axes on two sides, and they are the same?
You can set yAxis to be an array of y axes and max value should be set to make sure they are the same. Then, hide splitLine of the right axis.

@Ovilia thanks for your quick reply!

I had previously tried something like this, but ran into problems with deviating values, as you mentioned. I thought that was because the min & max was automatically deducted from the series, but on second thought, I think I overlooked something. I will try again and get back shortly...

@mglimmerveen
Copy link
Author

mglimmerveen commented Nov 8, 2019

I can't seem to get it working. We are using "dataMin" and "dataMax" to set the scale of the y-axis, but when I duplicate the y-axis, the 2nd y-axis doesn't get rendered. I think it requires a 2nd series? (N.B. If I manually provide a min and max it does get rendered.)

Aside from that, I would say that it would be more robust and clean to just declare that you want the y-axis printed twice, rather than duplicating it manually. Wouldn't you agree?

@Ovilia
Copy link
Contributor

Ovilia commented Nov 10, 2019

You need an extra series binding to the second y axis and keep the two series and axes the same.

@Ovilia Ovilia added waiting-for: author and removed pending We are not sure about whether this is a bug/new feature. waiting-for: community labels Nov 10, 2019
@mglimmerveen
Copy link
Author

As I pointed out in the first post, I did try duplicating the entire series. So, yeah, that would certainly work. And I guess it might be doable in case of a small chart, but does have a negative performance impact on rendering larger data sets.

I would personally argue that this is a suboptimal solution/workaround.

@Ovilia
Copy link
Contributor

Ovilia commented Nov 14, 2019

Set the second series to be show: false

@Ovilia Ovilia added the inactive Not active for some time or no response from the author. Will be closed soon. label Jan 13, 2020
@echarts-bot
Copy link

echarts-bot bot commented Jan 13, 2020

This issue is closed due to not being active. Please feel free to open it again (for the author) or create a new one and reference this (for others) if you have further questions.

@echarts-bot echarts-bot bot closed this as completed Jan 13, 2020
@mglimmerveen
Copy link
Author

I'm sorry, I kind of forgot about this.

Nevertheless, I still do not understand why you would want me to duplicate an entire series, and then set it to show: false. It makes the code ugly, less descriptive and (most probably) also perform much less.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
en This issue is in English inactive Not active for some time or no response from the author. Will be closed soon. new-feature waiting-for: community
Projects
None yet
Development

No branches or pull requests

2 participants