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

Different colors on datasets #8

Open
boroneaionut opened this issue Apr 10, 2018 · 6 comments
Open

Different colors on datasets #8

boroneaionut opened this issue Apr 10, 2018 · 6 comments

Comments

@boroneaionut
Copy link

How can I set different colors on all datasets?
I tried using the default chartjs dataset options but it is not working and the with the colorFunction I can only set one color (or is it that I don't know how to use it).

Thank you.

@fanthos
Copy link
Owner

fanthos commented Apr 10, 2018

colorFunction returns Color() object by passing data element into it. You can log arguments in colorFunction to see arguments of the function.

@boroneaionut
Copy link
Author

Can you please give me an example?
I can't seem to figure it out.

@boroneaionut
Copy link
Author

Nevermind, I figured it out.
Thank you for your response.

@fanthos
Copy link
Owner

fanthos commented Apr 10, 2018

https://github.com/fanthos/chartjs-chart-timeline/blob/master/timeline.js#L245
The data object is the array: [starttime, endtime, text, extras....]. The color could passed as extra argument.
The extras could be accessed by

colorFunction(text, dataobj) {
extras = dataobj[3]
...
}

@boroneaionut
Copy link
Author

That's what I have done.
Thank you for the explicit response.
And very nice job with the plugin. Very useful.
👍

Have a great day!

@aftab-git
Copy link

@fanthos need to set min and max time on x axis how i can achieve?

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

3 participants