Bug Fixed decimals on formulas

This commit is contained in:
Luis Fernando Molina committed 2020-05-18 18:35:03 +02:00
1 parent 3cb16b4e62
commit c03a8c4170
2 files changed
+17 -13

No files matched your search

+16 -12
View File
@@ -181,18 +181,6 @@ function newSpeedometer () {
/* We put the thisObject.params.VALUE in the middle */
fontSize = 22
if (thisObject.params.VALUE > 999) {
fontSize = 18
}
if (thisObject.params.VALUE > 9999) {
fontSize = 14
}
if (thisObject.params.VALUE > 99999) {
fontSize = 10
}
browserCanvasContext.font = 'bold ' + fontSize + 'px ' + UI_FONT.PRIMARY
label = thisObject.params.VALUE
if (isNaN(label) === false) {
@@ -202,6 +190,22 @@ function newSpeedometer () {
if (label === 0) { label = label.toFixed(2) }
}
fontSize = 22
if (label.length > 8) {
fontSize = 18
}
if (label.length > 10) {
fontSize = 14
}
if (label.length > 12) {
fontSize = 10
}
if (label.length > 14) {
fontSize = 8
}
browserCanvasContext.font = 'bold ' + fontSize + 'px ' + UI_FONT.PRIMARY
// label = label.substring(0, 6)
xOffset = label.length / 2 * fontSize * FONT_ASPECT_RATIO + 7
+1 -1
View File
@@ -1351,7 +1351,7 @@ function newUiObject () {
label = currentValue
if (!isNaN(label)) {
if (currentValue.toFixed !== undefined) {
label = currentValue.toFixed(2)
label = dynamicDecimals(currentValue, 2)
}
}