diff --git a/src/components/vue-ui-sparkbar.vue b/src/components/vue-ui-sparkbar.vue index fd9313ae..9ddc9e84 100644 --- a/src/components/vue-ui-sparkbar.vue +++ b/src/components/vue-ui-sparkbar.vue @@ -144,17 +144,21 @@ function ratioToMax(val) { return val / max.value; } -function ratioTo(val) { +function ratioTo(bar) { + if (sparkbarConfig.value.style.layout.independant) { + if (bar.target) { + return bar.value / bar.target; + } if (sparkbarConfig.value.style.layout.percentage) { - return val / 100; + return bar.value / 100; } else if(sparkbarConfig.value.style.layout.target === 0) { return 1; } else { - return val / sparkbarConfig.value.style.layout.target + return bar.value / sparkbarConfig.value.style.layout.target } } else { - return ratioToMax(val) + return ratioToMax(bar.value) } } @@ -173,7 +177,7 @@ function selectDatapoint(datapoint, index) {
{{ bar.name }} - : {{ bar.prefix ? bar.prefix : '' }}{{ Number(bar.value.toFixed(bar.rounding ? bar.rounding : 0)).toLocaleString() }}{{ bar.suffix ? bar.suffix : '' }} + : {{ bar.prefix ? bar.prefix : '' }}{{ Number(bar.value.toFixed(bar.rounding ? bar.rounding : 0)).toLocaleString() }}{{ bar.suffix ? bar.suffix : '' }}
@@ -190,8 +194,8 @@ function selectDatapoint(datapoint, index) { - - + +