this.dateWindow_ = attrs.dateWindow || null;
this.valueRange_ = attrs.valueRange || null;
this.wilsonInterval_ = attrs.wilsonInterval || true;
+ this.is_initial_draw_ = true;
// Clear the div. This ensure that, if multiple dygraphs are passed the same
// div, then only one will be drawn.
return zeropad(d.getHours()) + ":" +
zeropad(d.getMinutes()) + ":" +
zeropad(d.getSeconds());
- } else if (d.getMinutes()) {
- return zeropad(d.getHours()) + ":" + zeropad(d.getMinutes());
} else {
- return zeropad(d.getHours());
+ return zeropad(d.getHours()) + ":" + zeropad(d.getMinutes());
}
}
* @private
*/
Dygraph.prototype.drawGraph_ = function(data) {
+ // This is used to set the second parameter to drawCallback, below.
+ var is_initial_draw = this.is_initial_draw_;
+ this.is_initial_draw_ = false;
+
var minY = null, maxY = null;
this.layout_.removeAllDatasets();
this.setColors_();
this.canvas_.height);
if (this.attr_("drawCallback") !== null) {
- this.attr_("drawCallback")(this);
+ this.attr_("drawCallback")(this, is_initial_draw);
}
};
Dygraph.dateParser = function(dateStr, self) {
var dateStrSlashed;
var d;
- if (dateStr.length == 10 && dateStr.search("-") != -1) { // e.g. '2009-07-12'
+ if (dateStr.search("-") != -1) { // e.g. '2009-7-12' or '2009-07-12'
dateStrSlashed = dateStr.replace("-", "/", "g");
while (dateStrSlashed.search("-") != -1) {
dateStrSlashed = dateStrSlashed.replace("-", "/");