X-Git-Url: https://adrianiainlam.tk/git/?a=blobdiff_plain;f=dygraph.js;h=bdfa1b11660628811328de983dc8cdb42baf153a;hb=1946f7ceb9125de69c2b123567a34590faa4b21f;hp=c5ee9d15f97c6faafa0528e100e180c5af101991;hpb=f8cfec734263f9eea52dd0a5c01bdf642ebc12b8;p=dygraphs.git diff --git a/dygraph.js b/dygraph.js index c5ee9d1..bdfa1b1 100644 --- a/dygraph.js +++ b/dygraph.js @@ -193,11 +193,11 @@ Dygraph.prototype.__init__ = function(div, file, attrs) { // Create the PlotKit grapher // TODO(danvk): why does the Layout need its own set of options? - this.layoutOptions_ = { 'errorBars': (this.attr_("errorBars") || - this.attr_("customBars")), - 'xOriginIsZero': false }; + this.layoutOptions_ = { 'xOriginIsZero': false }; Dygraph.update(this.layoutOptions_, this.attrs_); Dygraph.update(this.layoutOptions_, this.user_attrs_); + Dygraph.update(this.layoutOptions_, { + 'errorBars': (this.attr_("errorBars") || this.attr_("customBars")) }); this.layout_ = new DygraphLayout(this, this.layoutOptions_); @@ -755,7 +755,7 @@ Dygraph.prototype.mouseMove_ = function(event) { ctx.beginPath(); ctx.fillStyle = this.colors_[i%clen]; ctx.arc(canvasx, this.selPoints_[i%clen].canvasy, circleSize, - 0, 360, false); + 0, 2 * Math.PI, false); ctx.fill(); } ctx.restore(); @@ -1268,16 +1268,20 @@ Dygraph.prototype.rollingAverage = function(originalData, rollPeriod) { var y = data[1]; rollingData[i] = [originalData[i][0], [y, y - data[0], data[2] - y]]; - low += data[0]; - mid += y; - high += data[2]; - count += 1; + if (y && !isNaN(y)) { + low += data[0]; + mid += y; + high += data[2]; + count += 1; + } if (i - rollPeriod >= 0) { var prev = originalData[i - rollPeriod]; - low -= prev[1][0]; - mid -= prev[1][1]; - high -= prev[1][2]; - count -= 1; + if (prev[1][1] && !isNaN(prev[1][1])) { + low -= prev[1][0]; + mid -= prev[1][1]; + high -= prev[1][2]; + count -= 1; + } } rollingData[i] = [originalData[i][0], [ 1.0 * mid / count, 1.0 * (mid - low) / count,