Pārlūkot izejas kodu

fix intervals (#352)

tags/v1.6.3
David Schnurr pirms 3 gadiem
committed by GitHub
vecāks
revīzija
10de973608
Šim parakstam datu bāzē netika atrasta zināma atslēga GPG atslēgas ID: 4AEE18F83AFDEB23
1 mainītis faili ar 9 papildinājumiem un 1 dzēšanām
  1. +9
    -1
      src/js/utils/intervals.js

+ 9
- 1
src/js/utils/intervals.js Parādīt failu

@@ -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;
}



Notiek ielāde…
Atcelt
Saglabāt