gmmoraesbr / flot

Automatically exported from code.google.com/p/flot
0 stars 0 forks source link

[patch] Fix parsing single datapoint when 0 #344

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
When the data set for some plugins is just a single number instead of [x,y] 
points, parsing it fails when the datapoint is 0 as in:
  data: [ { data: 0, label: 'zero' } ]
instead of:
  data: [ { data: [ 0 ], label: 'zero' } ]
or:
  data: [ { data: [ [ 0 ] ], label: 'zero' } ]

This patch against r259 fixes the check for the existence of the data 
property in the series to not fail in this case.

Original issue reported on code.google.com by vpa...@gmail.com on 10 May 2010 at 8:30

Attachments:

GoogleCodeExporter commented 8 years ago
Fixed, thanks!

Original comment by olau%iol...@gtempaccount.com on 13 Dec 2010 at 4:14

GoogleCodeExporter commented 8 years ago
I'm curious...  Is there a reason you chose to still rely on checking the value 
of .data instead of checking for its existence?  This way, if d[i].data exists 
but has a value of null, the same problem will happen, but using the 'in' 
operator as in my patch, it would check for the existence of the .data member 
of d[i] and properly handle it.

Original comment by vpa...@gmail.com on 14 Dec 2010 at 3:50