When div is of type string, replace it with a document element.
authorRobert Konigsberg <konigsberg@google.com>
Thu, 22 Nov 2012 17:55:03 +0000 (12:55 -0500)
committerRobert Konigsberg <konigsberg@google.com>
Thu, 22 Nov 2012 17:55:03 +0000 (12:55 -0500)
dygraph.js

index c7f7087..42e87c8 100644 (file)
@@ -355,6 +355,10 @@ Dygraph.prototype.__init__ = function(div, file, attrs) {
 
   attrs = Dygraph.mapLegacyOptions_(attrs);
 
+  if (typeof(div) == 'string') {
+    div = document.getElementById(div);
+  }
+
   if (!div) {
     Dygraph.error("Constructing dygraph with a non-existent div!");
     return;