this.wilsonInterval_ = attrs.wilsonInterval || true;
this.customBars_ = attrs.customBars || false;
+ // Clear the div. This ensure that, if multiple dygraphs are passed the same
+ // div, then only one will be drawn.
+ div.innerHTML = "";
+
// If the div isn't already sized then give it a default size.
if (div.style.width == '') {
div.style.width = Dygraph.DEFAULT_WIDTH + "px";
this.attrs_.xValueFormatter = Dygraph.dateString_;
this.attrs_.xValueParser = Dygraph.dateParser;
this.attrs_.xTicker = Dygraph.dateTicker;
- } else if (indepType != 'number') {
+ } else if (indepType == 'number') {
this.attrs_.xValueFormatter = function(x) { return x; };
this.attrs_.xValueParser = function(x) { return parseFloat(x); };
this.attrs_.xTicker = Dygraph.numericTicks;
} else {
- this.error("only 'date' and 'number' types are supported for column 1" +
+ this.error("only 'date' and 'number' types are supported for column 1 " +
"of DataTable input (Got '" + indepType + "')");
return null;
}
var ret = [];
for (var i = 0; i < rows; i++) {
var row = [];
+ if (!data.getValue(i, 0)) continue;
if (indepType == 'date') {
row.push(data.getValue(i, 0).getTime());
} else {
row.push(data.getValue(i, 0));
}
+ var any_data = false;
for (var j = 1; j < cols; j++) {
row.push(data.getValue(i, j));
+ if (data.getValue(i, j)) any_data = true;
}
- ret.push(row);
+ if (any_data) ret.push(row);
}
return ret;
}