dynamicDecimals
This commit is contained in:
1 parent
dbbd25559f
commit
a1cfd82ab3
2 files changed
+10
-6
No files matched your search
+1
-6
@@ -487,12 +487,7 @@ function newRateScale () {
|
||||
rate = coordinateSystem.max.y
|
||||
}
|
||||
|
||||
let decimals = 2
|
||||
if (rate < 1) { decimals = 4 }
|
||||
if (Math.trunc(rate * 100) < 1) { decimals = 6 }
|
||||
if (Math.trunc(rate * 10000) < 1) { decimals = 8 }
|
||||
if (Math.trunc(rate * 1000000) < 1) { decimals = 10 }
|
||||
let label = (rate - Math.trunc(rate)).toFixed(decimals)
|
||||
let label = dynamicDecimals(rate)
|
||||
let labelArray = label.split('.')
|
||||
let label1 = thisObject.payload.node.payload.parentNode.name
|
||||
let label2 = (Math.trunc(rate)).toLocaleString()
|
||||
|
||||
@@ -22,6 +22,15 @@ function drawContainerBackground (container, color, opacity, fitFunction) {
|
||||
browserCanvasContext.fill()
|
||||
}
|
||||
|
||||
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 }
|
||||
return (value - Math.trunc(value)).toFixed(decimals)
|
||||
}
|
||||
|
||||
function savePropertyAtNodeConfig (payload, propertyName, value) {
|
||||
try {
|
||||
let code = JSON.parse(payload.node.code)
|
||||
|
||||
Reference in new issue
Block a user