chartjs-chart-timeline
chartjs-chart-timeline copied to clipboard
Different colors on datasets
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.
colorFunction
returns Color()
object by passing data element into it. You can log arguments
in colorFunction
to see arguments of the function.
Can you please give me an example? I can't seem to figure it out.
Nevermind, I figured it out. Thank you for your response.
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]
...
}
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!
@fanthos need to set min and max time on x axis how i can achieve?