Fix example to only use public API. This required changing updateOptions to better...
[dygraphs.git] / dygraph.js
index 958f94b..b8ce5e2 100644 (file)
@@ -816,8 +816,8 @@ Dygraph.prototype.createDragInterface_ = function() {
       self.dateWindow_ = [minDate, maxDate];
 
 
-      // y-axis scaling is automatic unless a valueRange is defiend or
-      // if the user zooms in on the y-axis. If neither is true, valueWindow
+      // y-axis scaling is automatic unless a valueRange is defined or
+      // if the user zooms in on the y-axis. If neither is true, valueWindow_
       // will be null.
       if (self.valueWindow_) {
         var maxValue = draggingValue + (dragEndY / self.height_) * valueRange;
@@ -2486,14 +2486,15 @@ Dygraph.prototype.start_ = function() {
  */
 Dygraph.prototype.updateOptions = function(attrs) {
   // TODO(danvk): this is a mess. Rethink this function.
-  if (attrs.rollPeriod) {
+  if ('rollPeriod' in attrs) {
     this.rollPeriod_ = attrs.rollPeriod;
   }
-  if (attrs.dateWindow) {
+  if ('dateWindow' in attrs) {
     this.dateWindow_ = attrs.dateWindow;
   }
-  if (attrs.valueRange) {
+  if ('valueRange' in attrs) {
     this.valueRange_ = attrs.valueRange;
+    this.valueWindow_ = attrs.valueRange;
   }
 
   // TODO(danvk): validate per-series options.