Add toString function to dygraph instances. Doesn't work with graphs on divs without...
authorRobert Konigsberg <konigsberg@google.com>
Fri, 4 Feb 2011 22:27:56 +0000 (17:27 -0500)
committerRobert Konigsberg <konigsberg@google.com>
Fri, 4 Feb 2011 22:27:56 +0000 (17:27 -0500)
dygraph.js

index b3433e2..e340a7b 100644 (file)
@@ -260,6 +260,12 @@ Dygraph.prototype.__init__ = function(div, file, attrs) {
   this.start_();
 };
 
+Dygraph.prototype.toString = function() {
+  var maindiv = this.maindiv_;
+  var id = (maindiv && maindiv.id) ? maindiv.id : maindiv
+  return "[Dygraph " + id + "]";
+}
+
 Dygraph.prototype.attr_ = function(name, seriesName) {
   if (seriesName &&
       typeof(this.user_attrs_[seriesName]) != 'undefined' &&