Chartjs-How to display that data was unavaible during some time in a Chart.js (or any other library's) timeline graph

0👍

With the new version 3 of chartjs which is releasing soon you can set the backgroundColor of the points like this:

backgroundColor: (context) => {return context.dataPoint?.y > 5 ? "green" : "red"}

And then you will have to put the right logic and values there. If you want the line also in different colors you will need to write a custom plugin for that since it is not supported by the default lib

Working example of points: https://jsfiddle.net/Leelenaleee/8bkz96cd/7/

Leave a comment