Chart.js: [Help] - Line charts: any way to prevent discontinuous line when null data ?

Created on 16 Jun 2016  Â·  6Comments  Â·  Source: chartjs/Chart.js

I have two lines to display on a chart, but with different labels, is there any way to prevent the discontinuous line when null values are passed ?
When null values, I'd like the line to extrapolate the value and draw the line to the next point.
http://codepen.io/morganlapin/pen/LZZeVM

support

Most helpful comment

The option is called spanGaps

so this will enabled it

options: {
  spanGaps: true
}

All 6 comments

Starting in v2.1.5 this is possible. I can't recall the name of the option off the top of my head, but looking in the doc files is a good start

I did look in the doc files, but could not find anything related to this option, neither in the chart configuration nor in the chart line options...

The option is called spanGaps

so this will enabled it

options: {
  spanGaps: true
}

Thanks for the option name, but it is still not working:
http://codepen.io/morganlapin/pen/LZZeVM
The option has to be passed to the dataset, but with a line chart, and a tension, it is still not working.
If I pass the tension to 0, it works.
http://codepen.io/morganlapin/pen/ZOOxdJ
Is it normal ?

It really should apply to all types of lines. I will look into it

This still seem to not be working correctly if the beginning of the array begins with null values. I'll make a codepen tomorrow, right now I'm about to fall asleep.

Was this page helpful?
0 / 5 - 0 ratings