Skip to content

Commit c0ebd70

Browse files
committed
Fix - VueUiKpi - Fix rounding error
1 parent a0b9ea5 commit c0ebd70

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/components/vue-ui-kpi.vue

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ const animateToValue = (targetValue) => {
3636
3737
function animate() {
3838
if (displayedValue.value < targetValue) {
39-
displayedValue.value = Number(Math.min(displayedValue.value + chunk, targetValue).toFixed(FINAL_CONFIG.value.valueRounding));
39+
displayedValue.value = Math.min(displayedValue.value + chunk, targetValue);
4040
} else if (displayedValue.value > targetValue) {
41-
displayedValue.value = Number(Math.max(displayedValue.value - chunk, targetValue).toFixed(FINAL_CONFIG.value.valueRounding));
41+
displayedValue.value = Math.max(displayedValue.value - chunk, targetValue);
4242
}
4343
4444
if (displayedValue.value !== targetValue) {
@@ -80,12 +80,12 @@ watch(() => props.dataset, (newValue) => {
8080
<template v-if="FINAL_CONFIG.analogDigits.show">
8181
<div :style="{ height: FINAL_CONFIG.analogDigits.height + 'px'}">
8282
<Digits
83-
:dataset="displayedValue"
83+
:dataset="Number(displayedValue.toFixed(FINAL_CONFIG.valueRounding))"
8484
:config="{
8585
backgroundColor: FINAL_CONFIG.backgroundColor,
8686
digits: {
8787
color: FINAL_CONFIG.analogDigits.color,
88-
skeletonColor: FINAL_CONFIG.analogDigits.skeletonColor
88+
skeletonColor: FINAL_CONFIG.analogDigits.skeleton
8989
}
9090
}"
9191
/>

0 commit comments

Comments
 (0)