Browse Source

UI: Fix progress bar widget percent value calculation.

pull/9460/head
Igor Kulikov 3 years ago
parent
commit
ec907c66ba
  1. 4
      ui-ngx/src/app/modules/home/components/widget/lib/cards/progress-bar-widget.component.ts

4
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();
}

Loading…
Cancel
Save