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

Problem with multiple yAxis & toggleSeries() #91

Closed
lukaszflorczak opened this issue Apr 17, 2019 · 8 comments · Fixed by gitthermal/thermal#73
Closed

Problem with multiple yAxis & toggleSeries() #91

lukaszflorczak opened this issue Apr 17, 2019 · 8 comments · Fixed by gitthermal/thermal#73
Labels
bug Something isn't working

Comments

@lukaszflorczak
Copy link

lukaszflorczak commented Apr 17, 2019

Demo: https://codepen.io/lukaszflorczak/pen/yrpWgZ

I have a chart like that in my project. I have 6 series of data: 1-4 use common y-axis on the left and 5-6 use common y-axis on the right. I also have buttons to disable/enable each series.

const initialYaxis = [
	{ seriesName: 'wideContacts', show: true },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'netValue', opposite: true, show: true },
	{ seriesName: 'netValue', opposite: true, show: false }
]

Problem 1

If I disable for example the first series I need to change params of y-axis for series 2-4 because the first series y-axis is not visible. In the demo, you can see prepareYaxis() method for this. And it looks that it works. Unfortunately, if I disable any series I can't enable it again.

In this issue: apexcharts/apexcharts.js#366 I got a suggestion to use showAlways option, but I'm doing something wrong or it doesn't work when I toggle the data series.

I tried to use render() method, but it doesn't work (exist?). In the local environment, I use [email protected] and [email protected].

How should I do charts like that? Where is the problem?


Problem 2

It's not so important for me at this moment, and maybe it's related to problem 1, but... At the beginning I see all data in the tooltip together:

Zrzut ekranu 2019-04-17 o 06 52 51

But if I disable one of the series I see the separate tooltip for each chart/series:

Zrzut ekranu 2019-04-17 o 06 52 33

I mentioned it here: apexcharts/apexcharts.js#367 before.


PS. I hope it's not a problem that I start a new issue. But I thought it would be better to start a new one in vue-apexcharts repo because maybe some of those problems are specific just for the Vue version.

@junedchhipa
Copy link
Contributor

Thank you for the detailed description and sorry for the delayed response.
In a multi-axis chart, you don't need to prepare y-axis is one of the common series gets collapsed.

Such an issue has already been fixed previously, but I will check again.
I will be back with some workaround/fix for this, thanks!

@junedchhipa junedchhipa added the bug Something isn't working label Apr 20, 2019
@lukaszflorczak
Copy link
Author

In a multi-axis chart, you don't need to prepare y-axis is one of the common series gets collapsed.

But if I use a config like this one:

const initialYaxis = [
	{ seriesName: 'wideContacts', show: true },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'wideContacts', show: false },
	{ seriesName: 'netValue', opposite: true, show: true },
	{ seriesName: 'netValue', opposite: true, show: false }
]

and when I disable first serie, the left yaxis (even if serie 2, 3 and 4 are active) is invisible. Is there another solution for this case?

You tagged my issues as bug. Is there any progress?

@junedchhipa
Copy link
Contributor

Sorry, no progress yet. I have been occupied with a major refactor looking into the increasing bundle size.
Thanks for the additional info, I will definitely try to fix it soon.

@caoguotao
Copy link

meet the same problem in Vue project. until I find that when toggling legend the series props will change,
so I try cloneDeep the series as a computed property return

@junedchhipa
Copy link
Contributor

The issue is fixed as specified in the commit mentioned above.
The patch will be released today in 3.6.12

@lukaszflorczak
Copy link
Author

lukaszflorczak commented May 21, 2019

Hi! Thank you for the update. Unfortunately, I still have a problem with yAxis and I can't achieve the intended effect. It's very important for our project.

EDIT: I'm sorry – probably it works with showAlways param now. I'll confirm soon.

@junedchhipa
Copy link
Contributor

junedchhipa commented May 21, 2019

Yeah, the showAlways param is important and will help in achieving the intended result.

@lukaszflorczak
Copy link
Author

Generally, after update, we find a lot of strange situations:

Zrzut ekranu 2019-05-22 o 05 55 26

For example in this case:

  1. The red line shouldn't be visible
  2. The red line highest point should be on the same point/day as the dark one

But finally, we resigned from toggleSeries() method and now we just change series dynamically –  if we want to disable one of them we just change them by an empty array.
And then probably everything is working right.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants