sunjavagroups / flot

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

Threshold plugin does not handle null values #688

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Threshold plugin does not handle null values - null values are used to separate 
line segments.

Sample HTML showing error attached.

Fix for code also attached - the null value needs to be inserted into both line 
segments.

Original issue reported on code.google.com by datamys...@gmail.com on 18 Apr 2012 at 3:12

Attachments:

GoogleCodeExporter commented 8 years ago

Original comment by dnsch...@gmail.com on 5 Jun 2012 at 4:17

GoogleCodeExporter commented 8 years ago
The provided fix does not work if your point size (ps) is different than 2.  If 
that's your case, replace :

//push a null value into both series
threspoints.push(x);
threspoints.push(y);
newpoints.push(x);
newpoints.push(y);

with :

//push null values for both series.
for (j = 0; j < ps; j++) {
    newpoints.push(null);
    threspoints.push(null);
}

That way, no matter what's your point size, you will add enough null values.

Original comment by Maxime.M...@gmail.com on 4 Jul 2012 at 5:44