Merge pull request #149 from flooey/master
authorDan Vanderkam <danvdk@gmail.com>
Fri, 11 May 2012 18:43:10 +0000 (11:43 -0700)
committerDan Vanderkam <danvdk@gmail.com>
Fri, 11 May 2012 18:43:10 +0000 (11:43 -0700)
Three bug fixes

dygraph-utils.js
plugins/legend.js

index f5440c7..63411a5 100644 (file)
@@ -598,7 +598,7 @@ Dygraph.updateDeep = function (self, o) {
           // DOM objects are shallowly-copied.
           self[k] = o[k];
         } else if (typeof(o[k]) == 'object') {
-          if (typeof(self[k]) != 'object') {
+          if (typeof(self[k]) != 'object' || self[k] === null) {
             self[k] = {};
           }
           Dygraph.updateDeep(self[k], o[k]);
index 68a6762..f5f4711 100644 (file)
@@ -150,6 +150,7 @@ legend.prototype.predraw = function(e) {
   if (!this.is_generated_div_) return;
 
   // TODO(danvk): only use real APIs for this.
+  e.dygraph.graphDiv.appendChild(this.legend_div_);
   var area = e.dygraph.plotter_.area;
   this.legend_div_.style.left = area.x + area.w - e.dygraph.getOption("labelsDivWidth") - 1 + "px";
   this.legend_div_.style.top = area.y + "px";