allow dateWindow to be set explicitly in layout (previously it was deduced from the...
[dygraphs.git] / dygraph.js
index 8895a39..386781d 100644 (file)
@@ -1248,11 +1248,14 @@ Dygraph.prototype.drawGraph_ = function(data) {
   this.addXTicks_();
 
   // Tell PlotKit to use this new data and render itself
+  if (this.dateWindow_) {
+    this.layout_.updateOptions({dateWindow: this.dateWindow_});
+  }
   this.layout_.evaluateWithError();
   this.plotter_.clear();
   this.plotter_.render();
-  this.canvas_.getContext('2d').clearRect(0, 0,
-                                         this.canvas_.width, this.canvas_.height);
+  this.canvas_.getContext('2d').clearRect(0, 0, this.canvas_.width,
+                                         this.canvas_.height);
 };
 
 /**