Permalink
Browse files

Merge pull request #18 from bis12/fix_disc_rendering

Fix discontinuous rendering issues
  • Loading branch information...
fhats committed Aug 18, 2012
2 parents ec227d9 + efbd669 commit 736de8104a5edc7cb8850695c0f7c0bd70dba549
Showing with 16 additions and 11 deletions.
  1. +2 −3 firefly/data_sources/ganglia_rrd.py
  2. +2 −3 firefly/data_sources/test_data.py
  3. +12 −5 firefly/static/js/renderer.js
@@ -82,9 +82,8 @@ def data(self, sources, start, end, width):
for v in row.findall("v"):
value = float(v.text)
values.append("%g" % value if not math.isnan(value) else None)
- if any(values):
- values_string = ",".join(v if v else "null" for v in values)
- data.append('{"t":%d,"v":[%s]}' % (time, values_string))
+ values_string = ",".join(v if v else "null" for v in values)
+ data.append('{"t":%d,"v":[%s]}' % (time, values_string))
except Exception, e:
raise tornado.web.HTTPError(500, log_message=str(e))
@@ -35,9 +35,8 @@ def data(self, sources, start, end, width):
else:
disc = sine/2
val.append(disc)
- if any(val):
- values_string = ",".join("%0.4f"%(v,) if v else "null" for v in val)
- data.append('{"t":%d,"v":[%s]}' % (t, values_string))
+ values_string = ",".join("%0.4f"%(v,) if v else "null" for v in val)
+ data.append('{"t":%d,"v":[%s]}' % (t, values_string))
return "[%s]" % ','.join(data)
def legend(self, sources):
@@ -268,16 +268,23 @@ firefly.Renderer.prototype.getDataCoords_ = function(layers, axes, timeAtMouseX)
var closestPoint = layer.data[closestDataIndexToTime];
var closestDataPointX = this.xScale(closestPoint.x + layer.shift);
- var yVal = closestPoint.y + closestPoint.y0;
+ var dotX = dotY = null;
+ var yVal = (closestPoint.y + closestPoint.y0).toFixed(3);
+ if (closestPoint.y !== null) {
+ dotX = closestDataPointX;
+ dotY = this.yScale(yVal);
+ }
+ else {
+ yVal = 'undef';
+ }
dataPoints.push({
- 'dotX': closestDataPointX,
- 'dotY': this.yScale(yVal),
+ 'dotX': dotX,
+ 'dotY': dotY,
'date': new Date(closestPoint.x),
- 'value': yVal.toFixed(3)
+ 'value': yVal
});
}
-
return dataPoints;
};

0 comments on commit 736de81

Please sign in to comment.