X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=656d7a82adabe045e7a7dfa93ce7772ee747e995;hb=7aedf6fee4cad9a3fc6de49476fc176e48a090fa;hp=f5e19ab63afa6644f8759cfe144614c5cf8772b0;hpb=e863a17dc17dd729415d3d9fe6c608478a759a4c;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index f5e19ab..656d7a8 100644 --- a/dygraph.js +++ b/dygraph.js @@ -221,7 +221,7 @@ Dygraph.prototype.__old_init__ = function(div, file, labels, attrs) { /** * Initializes the Dygraph. This creates a new DIV and constructs the PlotKit - * and context <canvas> inside of it. See the constructor for details + * and context <canvas> inside of it. See the constructor for details. * on the parameters. * @param {Element} div the Element to render the graph into. * @param {String | Function} file Source data @@ -254,7 +254,7 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { this.wilsonInterval_ = attrs.wilsonInterval || true; this.is_initial_draw_ = true; this.annotations_ = []; - + // Number of digits to use when labeling the x (if numeric) and y axis // ticks. this.numXDigits_ = 2; @@ -331,6 +331,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' && @@ -1470,7 +1476,7 @@ Dygraph.prototype.mouseMove_ = function(event) { var points = this.layout_.points; // This prevents JS errors when mousing over the canvas before data loads. - if (points === 'undefined') return; + if (points === undefined) return; var lastx = -1; var lasty = -1; @@ -1802,8 +1808,10 @@ Dygraph.prototype.addXTicks_ = function() { var ret = formatter(range[0], range[1], this); var xTicks = []; + // Note: numericTicks() returns a {ticks: [...], numDigits: yy} dictionary, + // whereas dateTicker and user-defined tickers typically just return a ticks + // array. if (ret.ticks !== undefined) { - // numericTicks() returns multiple values. xTicks = ret.ticks; this.numXDigits_ = ret.numDigits; } else {