From: Jeremy Brewer Date: Wed, 23 Feb 2011 16:34:44 +0000 (-0500) Subject: Fixes from merging repo for two-axes.html and logscale.html. X-Git-Tag: v1.0.0~585 X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=e863a17dc17dd729415d3d9fe6c608478a759a4c;p=dygraphs.git Fixes from merging repo for two-axes.html and logscale.html. --- diff --git a/dygraph.js b/dygraph.js index 039c6ce..f5e19ab 100644 --- a/dygraph.js +++ b/dygraph.js @@ -1469,6 +1469,9 @@ Dygraph.prototype.mouseMove_ = function(event) { var canvasx = Dygraph.pageX(event) - Dygraph.findPosX(this.mouseEventElement_); var points = this.layout_.points; + // This prevents JS errors when mousing over the canvas before data loads. + if (points === 'undefined') return; + var lastx = -1; var lasty = -1; @@ -2110,7 +2113,7 @@ Dygraph.numericTicks = function(minV, maxV, self, axis_props, vals) { var ticks = []; if (vals) { for (var i = 0; i < vals.length; i++) { - ticks[i].push({v: vals[i]}); + ticks.push({v: vals[i]}); } } else { if (axis_props && attr("logscale")) { @@ -2224,6 +2227,7 @@ Dygraph.numericTicks = function(minV, maxV, self, axis_props, vals) { // Add labels to the ticks. for (var i = 0; i < ticks.length; i++) { + if (ticks[i].label !== undefined) continue; // Use current label. var tickV = ticks[i].v; var absTickV = Math.abs(tickV); var label = (formatter !== undefined) ? @@ -2356,7 +2360,7 @@ Dygraph.prototype.drawGraph_ = function() { // On the log scale, points less than zero do not exist. // This will create a gap in the chart. Note that this ignores // connectSeparatedPoints. - if (point < 0) { + if (point <= 0) { point = null; } series.push([date, point]);