From c1dd63574fcdf9cc930db7b89d8284bbd383c4ea Mon Sep 17 00:00:00 2001 From: jos Date: Mon, 29 Feb 2016 10:08:28 +0100 Subject: [PATCH] Fixed #1692: Error when y-axis values are equal --- HISTORY.md | 7 +++++++ lib/timeline/component/DataScale.js | 4 +++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/HISTORY.md b/HISTORY.md index 49e09d02..107647df 100644 --- a/HISTORY.md +++ b/HISTORY.md @@ -2,6 +2,13 @@ http://visjs.org +## not-yet-released, version 4.15.1 + +### Graph2d + +- Fixed #1692: Error when y-axis values are equal. + + ## 2016-02-23, version 4.15.0 ### Timeline diff --git a/lib/timeline/component/DataScale.js b/lib/timeline/component/DataScale.js index 5065f0e3..a87477fb 100644 --- a/lib/timeline/component/DataScale.js +++ b/lib/timeline/component/DataScale.js @@ -59,7 +59,9 @@ DataScale.prototype.determineScale = function () { var range = this._end - this._start; this.scale = this.containerHeight / range; var minimumStepValue = this.majorCharHeight / this.scale; - var orderOfMagnitude = Math.round(Math.log(range) / Math.LN10); + var orderOfMagnitude = (range > 0) + ? Math.round(Math.log(range) / Math.LN10) + : 0; this.minorStepIdx = -1; this.magnitudefactor = Math.pow(10, orderOfMagnitude);