From: Robert Konigsberg Date: Mon, 12 May 2014 08:44:07 +0000 (-0400) Subject: Mind renaming. X-Git-Url: https://adrianiainlam.tk/git/?a=commitdiff_plain;h=25fb7ebf9bee129460ac8bb6d421107573d36f87;p=dygraphs.git Mind renaming. --- diff --git a/dygraph-layout.js b/dygraph-layout.js index d9d5899..41ec54e 100644 --- a/dygraph-layout.js +++ b/dygraph-layout.js @@ -184,13 +184,13 @@ DygraphLayout.prototype.evaluate = function() { DygraphLayout.prototype._evaluateLimits = function() { var xlimits = this.dygraph_.xAxisRange(); - this._xAxis.minxval = xlimits[0]; - this._xAxis.maxxval = xlimits[1]; + this._xAxis.minval = xlimits[0]; + this._xAxis.maxval = xlimits[1]; var xrange = xlimits[1] - xlimits[0]; - this._xAxis.xscale = (xrange !== 0 ? 1 / xrange : 1.0); + this._xAxis.scale = (xrange !== 0 ? 1 / xrange : 1.0); if (this.dygraph_.getOptionForAxis("logscale", 'x')) { - this._xAxis.xlogrange = Dygraph.log10(this._xAxis.maxxval) - Dygraph.log10(this._xAxis.minxval); + this._xAxis.xlogrange = Dygraph.log10(this._xAxis.maxval) - Dygraph.log10(this._xAxis.minval); this._xAxis.xlogscale = (this._xAxis.xlogrange !== 0 ? 1.0 / this._xAxis.xlogrange : 1.0); } for (var i = 0; i < this.yAxes_.length; i++) { @@ -212,6 +212,14 @@ DygraphLayout.prototype._evaluateLimits = function() { } }; +DygraphLayout.calcXNormal_ = function(value, xAxis, logscale) { + if (logscale) { + return ((Dygraph.log10(value) - Dygraph.log10(xAxis.minval)) * xAxis.xlogscale); + } else { + return (value - xAxis.minval) * xAxis.scale; + } +}; + /** * @param {DygraphAxisType} axis * @param {number} value @@ -243,7 +251,7 @@ DygraphLayout.prototype._evaluateLineCharts = function() { var point = points[j]; // Range from 0-1 where 0 represents left and 1 represents right. - point.x = DygraphLayout._calcXNormal(point.xval, this._xAxis, isLogscaleForX); + point.x = DygraphLayout.calcXNormal_(point.xval, this._xAxis, isLogscaleForX); // Range from 0-1 where 0 represents top and 1 represents bottom var yval = point.yval; if (isStacked) {