Skip to content
This repository
Browse code

Merge pull request #18 from bis12/fix_disc_rendering

Fix discontinuous rendering issues
  • Loading branch information...
commit 736de8104a5edc7cb8850695c0f7c0bd70dba549 2 parents ec227d9 + efbd669
Fred Hatfull authored August 17, 2012
5  firefly/data_sources/ganglia_rrd.py
@@ -82,9 +82,8 @@ def data(self, sources, start, end, width):
82 82
                 for v in row.findall("v"):
83 83
                     value = float(v.text)
84 84
                     values.append("%g" % value if not math.isnan(value) else None)
85  
-                if any(values):
86  
-                    values_string = ",".join(v if v else "null" for v in values)
87  
-                    data.append('{"t":%d,"v":[%s]}' % (time, values_string))
  85
+                values_string = ",".join(v if v else "null" for v in values)
  86
+                data.append('{"t":%d,"v":[%s]}' % (time, values_string))
88 87
         except Exception, e:
89 88
             raise tornado.web.HTTPError(500, log_message=str(e))
90 89
 
5  firefly/data_sources/test_data.py
@@ -35,9 +35,8 @@ def data(self, sources, start, end, width):
35 35
                     else:
36 36
                         disc = sine/2
37 37
                     val.append(disc)
38  
-            if any(val):
39  
-                values_string = ",".join("%0.4f"%(v,) if v else "null" for v in val)
40  
-                data.append('{"t":%d,"v":[%s]}' % (t, values_string))
  38
+            values_string = ",".join("%0.4f"%(v,) if v else "null" for v in val)
  39
+            data.append('{"t":%d,"v":[%s]}' % (t, values_string))
41 40
         return "[%s]" % ','.join(data)
42 41
 
43 42
     def legend(self, sources):
17  firefly/static/js/renderer.js
@@ -268,16 +268,23 @@ firefly.Renderer.prototype.getDataCoords_ = function(layers, axes, timeAtMouseX)
268 268
 		var closestPoint = layer.data[closestDataIndexToTime];
269 269
 		var closestDataPointX = this.xScale(closestPoint.x + layer.shift);
270 270
 
271  
-		var yVal = closestPoint.y + closestPoint.y0;
  271
+		var dotX = dotY = null;
  272
+		var yVal = (closestPoint.y + closestPoint.y0).toFixed(3);
  273
+		if (closestPoint.y !== null) {
  274
+			dotX = closestDataPointX;
  275
+			dotY = this.yScale(yVal);
  276
+		}
  277
+		else {
  278
+			yVal = 'undef';
  279
+		}
272 280
 		dataPoints.push({
273  
-			'dotX': closestDataPointX,
274  
-			'dotY': this.yScale(yVal),
  281
+			'dotX': dotX,
  282
+			'dotY': dotY,
275 283
 			'date': new Date(closestPoint.x),
276  
-			'value': yVal.toFixed(3)
  284
+			'value': yVal
277 285
 		});
278 286
 
279 287
 	}
280  
-
281 288
 	return dataPoints;
282 289
 };
283 290
 

0 notes on commit 736de81

Please sign in to comment.
Something went wrong with that request. Please try again.