From ec907c66bad9387c6d8aac5b3970a037ea91a7bd Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Thu, 19 Oct 2023 15:05:01 +0300 Subject: [PATCH] UI: Fix progress bar widget percent value calculation. --- .../widget/lib/cards/progress-bar-widget.component.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts b/ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts index fe1ac58ab4..22d3cb6f4d 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts @@ -181,7 +181,9 @@ export class ProgressBarWidgetComponent implements OnInit, OnDestroy, AfterViewI this.valueColor.update(this.value); this.barColor.update(this.value); const range = this.settings.tickMax - this.settings.tickMin; - this.barWidth = `${(this.value / range) * 100}%`; + let barWidthValue = ((this.value - this.settings.tickMin) / range) * 100; + barWidthValue = Math.max(0, Math.min(100, barWidthValue)); + this.barWidth = `${barWidthValue}%`; this.cd.detectChanges(); }