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

Showing multiple charts makes the area coloring go wrong #11

Open
easymind76 opened this issue Feb 2, 2018 · 1 comment
Open

Showing multiple charts makes the area coloring go wrong #11

easymind76 opened this issue Feb 2, 2018 · 1 comment

Comments

@easymind76
Copy link

easymind76 commented Feb 2, 2018

When I show one chart, everything is fine, but showing multiple, and the threshold coloring doesn't seem to work.

I made a codepen:
https://codepen.io/anon/pen/eVJywN

You can easily see that it can work by removing the .chart-XRP div, so you only draw one chart. You will see red and green area. But drawing more then one chart and everything stays green.

I have tried to instantiate both chart instances in their own context, tried to make sure I use unique names for everything. But perhaps the issue isn't about variable references, maybe it has to do with targeting dom elements wrongly. I don't know.

@easymind76
Copy link
Author

I have looked into it some more. Problem seems to be using the same maskNames in all charts. They are put on the masks as IDs. So you end up having multiple same IDs on the page.
I can pass unique mask names to the plugin, so your code can run fine.
But maybe appending a unique string to the maskNames would be a general better solution.
In your code you could do perhaps:

line 88 insert:
var rand = Math.random().toString(36).substr(2, 16);
options.maskNames.aboveThreshold += rand;
options.maskNames.belowThreshold += rand;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant