From: Robert Konigsberg Date: Fri, 4 Feb 2011 22:27:56 +0000 (-0500) Subject: Add toString function to dygraph instances. Doesn't work with graphs on divs without... X-Git-Tag: v1.0.0~584^2~2^2~3 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=22bd1dfbc02a94d066898aa35c519eab0247a5e0;p=dygraphs.git Add toString function to dygraph instances. Doesn't work with graphs on divs without ids -- ever thought of adding a "name" attribute to support many graphs on a page? --- diff --git a/dygraph.js b/dygraph.js index b3433e2..e340a7b 100644 --- a/dygraph.js +++ b/dygraph.js @@ -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' &&