From aa2a2d61a9d9a2463b94fcaa398201e437c7d34f Mon Sep 17 00:00:00 2001 From: Ludo Stellingwerff Date: Wed, 20 Jan 2016 16:11:10 +0100 Subject: [PATCH] minor cleanups. --- lib/timeline/DataStep.js | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/lib/timeline/DataStep.js b/lib/timeline/DataStep.js index d533eb43..ac2ae7fd 100644 --- a/lib/timeline/DataStep.js +++ b/lib/timeline/DataStep.js @@ -26,9 +26,7 @@ */ function DataStep(start, end, minimumStep, containerHeight, customRange, formattingFunction, alignZeros) { // variables - this.current = 0; - - this.autoScale = true; + this.current = -1; this.stepIndex = 0; this.step = 1; this.scale = 1; @@ -36,7 +34,6 @@ function DataStep(start, end, minimumStep, containerHeight, customRange, formatt this.marginStart; this.marginEnd; - this.deadSpace = 0; this.majorSteps = [1, 2, 5, 10]; this.minorSteps = [0.25, 0.5, 1, 2]; @@ -67,13 +64,9 @@ DataStep.prototype.setRange = function(start, end, minimumStep, containerHeight, this._end = customRange.max === undefined ? end : customRange.max; if (this._start === this._end) { this._start = customRange.min === undefined ? this._start - 0.75 : this._start; - this._end = customRange.max === undefined ? this._end + 1 : this._end;; - } - - if (this.autoScale === true) { - this.setMinimumStep(minimumStep, containerHeight); + this._end = customRange.max === undefined ? this._end + 1 : this._end; } - + this.setMinimumStep(minimumStep, containerHeight); this.setFirst(customRange); }; @@ -138,9 +131,7 @@ DataStep.prototype.setFirst = function(customRange) { this.marginEnd += this.marginEnd % this.step; } - this.deadSpace = this.roundToMinor(niceEnd) - niceEnd + this.roundToMinor(niceStart) - niceStart; this.marginRange = this.marginEnd - this.marginStart; - this.current = this.marginEnd; }; @@ -194,6 +185,7 @@ DataStep.prototype.previous = function() { DataStep.prototype.getCurrent = function() { // prevent round-off errors when close to zero var current = (Math.abs(this.current) < this.step / 2) ? 0 : this.current; + var returnValue = current; if (typeof this.formattingFunction === 'function') { return this.formattingFunction(current);