ソースを参照

fix intervals (#352)

tags/v1.6.3
David Schnurr 3年前
committed by GitHub
コミット
10de973608
この署名に対応する既知のキーがデータベースに存在しません GPGキーID: 4AEE18F83AFDEB23
1個のファイルの変更9行の追加1行の削除
  1. +9
    -1
      src/js/utils/intervals.js

+ 9
- 1
src/js/utils/intervals.js ファイルの表示

@@ -69,7 +69,15 @@ function getChartIntervals(maxValue, minValue=0) {
normalMaxValue = normalMaxValue.toFixed(6);

let intervals = getChartRangeIntervals(normalMaxValue, normalMinValue);
intervals = intervals.map(value => value * Math.pow(10, exponent));
intervals = intervals.map(value => {
// For negative exponents we want to divide by 10^-exponent to avoid
// floating point arithmetic bugs. For instance, in javascript
// 6 * 10^-1 == 0.6000000000000001, we instead want 6 / 10^1 == 0.6
if (exponent < 0) {
return value / Math.pow(10, -exponent);
}
return value * Math.pow(10, exponent);
});
return intervals;
}



読み込み中…
キャンセル
保存