Support for a missing data value in line chart
When adding two lines to one chart there is always the issue that there are a few missing data values in each line. i.e. Jan Feb Mar Apr Line 1 has values for Jan, Feb and Apr Line 2 has values for Feb, Mar
At the moment there HAS to be a value for any label.
Please add the possibility to add a "null" value which causes the line connecting from the value before to the value after without plotting a value for the "null" part.
I also have this issue.
+1 this would be great to have!
I tried to replace some value by NaN, but it didn't work. This would definitly be useful.
+1 - it would be extremely useful!
+1
+1
This would be great
You can just make it skip over doing the drawing iteration for that line if its null. (Took me forever to find where its doing the line drawing.) The way it works before this is it will interpret null as zero.
822: for (var j=1; j<data.datasets[i].data.length; j++){ if (!data.datasets[i].data[j]) { continue; } 823: if (config.bezierCurve){
845: for (var k=0; k<data.datasets[i].data.length; k++){ if (!data.datasets[i].data[k]) { continue; } 846: ctx.beginPath();
The proposed solution by Linagee has some problems (curve and filling are not correct; solution not valid when the first value is missing).
In the alternate version that you will find at https://github.com/FVANCOP/ChartNew.js, I have implemented a solution that is more accurate. This version is down compatible with Nick's version.
Sample data that works in the alternate version :
var mydata1 = { labels : ["January","February","March","April","May","June","July"], datasets : [ { fillColor : "rgba(220,220,220,0.5)", strokeColor : "rgba(220,220,220,1)", pointColor : "rgba(220,220,220,1)", pointStrokeColor : "#fff", data : [0.65,0.59,0.90,0.81,0.56,0.55,1.00], title : "pFirst data" }, { fillColor : "rgba(151,187,205,0.5)", strokeColor : "rgba(151,187,205,1)", pointColor : "rgba(151,187,205,1)", pointStrokeColor : "#fff", data : [,0.34,,"0.19",0.96,0.27,], title : "pSecond data" } ] }
The alternate version also support negative values (which is not the case in Nick's version).
Would also like to see this feature in the main Chartjs. The new Chartjs has some nice new features. Both together would be great.
+1
Being worked on here: https://github.com/nnnick/Chart.js/pull/435
Closing this as duplicate of this.