From 22bd1dfbc02a94d066898aa35c519eab0247a5e0 Mon Sep 17 00:00:00 2001 From: Robert Konigsberg Date: Fri, 4 Feb 2011 17:27:56 -0500 Subject: [PATCH] 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? --- dygraph.js | 6 ++++++ 1 file changed, 6 insertions(+) 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' && -- 2.7.4