Ver a proveniência

fix intervals (#352)

tags/v1.6.3
David Schnurr há 3 anos
committed by GitHub
ascendente
cometimento
10de973608
Não foi encontrada uma chave conhecida para esta assinatura, na base de dados ID da chave GPG: 4AEE18F83AFDEB23
1 ficheiros alterados com 9 adições e 1 eliminações
  1. +9
    -1
      src/js/utils/intervals.js

+ 9
- 1
src/js/utils/intervals.js Ver ficheiro

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



Carregando…
Cancelar
Guardar