var first_point = true;
var addPoint = function(ctx_, point) {
if (point.name == setName) {
- if (first_point)
- ctx_.moveTo(point.canvasx, point.canvasy);
- else
- ctx_.lineTo(point.canvasx, point.canvasy);
- first_point = false;
+ if (isNaN(point.canvasy)) {
+ // this will make us move to the next point, not draw a line to it.
+ first_point = true;
+ } else {
+ if (first_point) {
+ ctx_.moveTo(point.canvasx, point.canvasy);
+ first_point = false;
+ } else {
+ ctx_.lineTo(point.canvasx, point.canvasy);
+ }
+ }
}
};
MochiKit.Iter.forEach(this.layout.points, partial(addPoint, ctx), this);
var replace = this.attr_('xValueFormatter')(lastx, this) + ":";
var clen = this.colors_.length;
for (var i = 0; i < selPoints.length; i++) {
+ if (isNaN(selPoints[i].canvasy)) continue;
if (this.attr_("labelsSeparateLines")) {
replace += "<br/>";
}
// Draw colored circles over the center of each selected point
ctx.save()
for (var i = 0; i < selPoints.length; i++) {
+ if (isNaN(selPoints[i%clen].canvasy)) continue;
ctx.beginPath();
ctx.fillStyle = this.colors_[i%clen].toRGBString();
ctx.arc(canvasx, selPoints[i%clen].canvasy, circleSize, 0, 360, false);
<html>
<head>
- <title>noise</title>
+ <title>missing data</title>
<!--[if IE]>
<script type="text/javascript" src="excanvas.js"></script>
<![endif]-->
<script type="text/javascript">
new Dygraph(
document.getElementById("graph"),
- "Date,Value\n" +
- "2009/12/01,10\n" +
- "2009/12/02,15\n" +
- "2009/12/03,\n" +
- "2009/12/04,20\n" +
- "2009/12/05,15\n"
+ "Date,GapSeries1,GapSeries2\n" +
+ "2009/12/01,10,10\n" +
+ "2009/12/02,15,11\n" +
+ "2009/12/03,,12\n" +
+ "2009/12/04,20,13\n" +
+ "2009/12/05,15,\n" +
+ "2009/12/06,18,15\n" +
+ "2009/12/07,12,16\n"
);
</script>
</body>