My array with null values in it is not populating the chart as expected
« Back to message list
Hi,
In my yearly weather graph I have a slight problem that it seems the last value (which is a null) is not drawn properly. From the graph it looks like only 11 values are there (the marker of February isn't on the grid).
When I replace the nulls with zero's it does draw the line complete and all markers are on the correct position.
It can be seen on: io-node.net/weatherstation/index.php?action=year
Regards,
Stephan
Posted by Richard on 22nd February 2014In my yearly weather graph I have a slight problem that it seems the last value (which is a null) is not drawn properly. From the graph it looks like only 11 values are there (the marker of February isn't on the grid).
When I replace the nulls with zero's it does draw the line complete and all markers are on the correct position.
It can be seen on: io-node.net/weatherstation/index.php?action=year
Regards,
Stephan
Hi there,
That's correct behaviour. null represents "no data" which is not necessarily the same as zero. To convert them you can use the Number function:
var num = Number(num);
Or perhaps this:
var num = num || 0;
Richard
That's correct behaviour. null represents "no data" which is not necessarily the same as zero. To convert them you can use the Number function:
var num = Number(num);
Or perhaps this:
var num = num || 0;
Richard
Add a reply
« Back to message list