Array with nulls not populate chart as expected

Share RGraph:   Share or Like RGraph on Facebook!

« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Stephan on 22nd February 2014
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 2014
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

Add a reply




« Back to message list