bug fixed

This commit is contained in:
Luis Fernando Molina committed 2020-03-17 15:56:53 +01:00
1 parent d4e1b101bb
commit c38ecae794
1 file changed
+6 -5
+6 -5
View File
@@ -25,11 +25,12 @@ function drawContainerBackground (container, color, opacity, fitFunction) {
function dynamicDecimals (value) {
let decimals = 2
if (value < 1) { decimals = 4 }
if (Math.trunc(value * 100) < 1) { decimals = 6 }
if (Math.trunc(value * 10000) < 1) { decimals = 8 }
if (Math.trunc(value * 1000000) < 1) { decimals = 10 }
if (Math.trunc(value * 100000000) < 1) { decimals = 12 }
if (Math.trunc(value * 10000000000) < 1) { decimals = 0 }
if (Math.abs(Math.trunc(value * 100)) < 1) { decimals = 6 }
if (Math.abs(Math.trunc(value * 10000)) < 1) { decimals = 8 }
if (Math.abs(Math.trunc(value * 1000000)) < 1) { decimals = 10 }
if (Math.abs(Math.trunc(value * 100000000)) < 1) { decimals = 12 }
if (Math.abs(Math.trunc(value * 10000000000)) < 1) { value = 0; decimals = 0 }
if (Math.trunc(value) === value) { decimals = 0 }
let returnValue = Number(value).toFixed(decimals)
return returnValue
}