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

Change the color of the scale depending on external conditions. #11

Closed
deviashin opened this issue Jun 8, 2020 · 4 comments
Closed

Comments

@deviashin
Copy link

Hello!

There is a structure "if else" as a result of which should change the color of the scale.

Please, how to do this?

Should get something like this:
var color;

if (condition) { color = "rgb(30, 148, 249)"; } else { color = "rgb(229, 73, 7)"; }

datasets: [ { data: [var], backgroundColor: 'color', } ]

@pandameister
Copy link
Owner

@deviashin sorry, i got busy didn't have time to take a look, did you work it out?

@deviashin
Copy link
Author

Hello! No, unfortunately, I still need help. Under normal circumstances, this works, but in relation to your schedules - it just disappears. I can’t understand how to write code correctly
Still need your help 😶

@deviashin deviashin reopened this Jun 16, 2020
@pandameister
Copy link
Owner

pandameister commented Jun 18, 2020

@deviashin your code should work, if you change 'color' to be [color] in:

datasets: [ { data: [var], backgroundColor: [color], } ]

@deviashin
Copy link
Author

Oh, those square brackets [ ]
Thank you very much, now everything is fine!

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

2 participants