UI: Improve widgets value formatting.

This commit is contained in:
Igor Kulikov 2023-10-20 13:06:02 +03:00
parent 54ef5364ec
commit a47ceaafed
6 changed files with 7 additions and 7 deletions

View File

@ -174,7 +174,7 @@ export class ProgressBarWidgetComponent implements OnInit, OnDestroy, AfterViewI
this.value = 0; this.value = 0;
if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) { if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) {
this.value = tsValue[1]; this.value = tsValue[1];
this.valueText = formatValue(this.value, this.decimals, this.units, true); this.valueText = formatValue(this.value, this.decimals, this.units, false);
} else { } else {
this.valueText = 'N/A'; this.valueText = 'N/A';
} }

View File

@ -182,7 +182,7 @@ export class ValueCardWidgetComponent implements OnInit, AfterViewInit, OnDestro
if (tsValue) { if (tsValue) {
ts = tsValue[0]; ts = tsValue[0];
value = tsValue[1]; value = tsValue[1];
this.valueText = formatValue(value, this.decimals, this.units, true); this.valueText = formatValue(value, this.decimals, this.units, false);
} else { } else {
this.valueText = 'N/A'; this.valueText = 'N/A';
} }

View File

@ -194,7 +194,7 @@ export class ValueChartCardWidgetComponent implements OnInit, AfterViewInit, OnD
let value; let value;
if (tsValue) { if (tsValue) {
value = tsValue[1]; value = tsValue[1];
this.valueText = formatValue(value, this.decimals, this.units, true); this.valueText = formatValue(value, this.decimals, this.units, false);
} else { } else {
this.valueText = 'N/A'; this.valueText = 'N/A';
} }

View File

@ -224,7 +224,7 @@ export class BatteryLevelWidgetComponent implements OnInit, OnDestroy, AfterView
this.value = 0; this.value = 0;
if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) { if (tsValue && isDefinedAndNotNull(tsValue[1]) && isNumeric(tsValue[1])) {
this.value = tsValue[1]; this.value = tsValue[1];
this.valueText = formatValue(this.value, this.decimals, this.units, true); this.valueText = formatValue(this.value, this.decimals, this.units, false);
} else { } else {
this.valueText = 'N/A'; this.valueText = 'N/A';
} }

View File

@ -232,7 +232,7 @@ export class SignalStrengthWidgetComponent implements OnInit, OnDestroy, AfterVi
if (!this.noData) { if (!this.noData) {
this.rssi = Number(value); this.rssi = Number(value);
if (this.showTooltipValue) { if (this.showTooltipValue) {
this.tooltipValueText = formatValue(value, this.decimals, this.units, true); this.tooltipValueText = formatValue(value, this.decimals, this.units, false);
} }
} else { } else {
this.rssi = -100; this.rssi = -100;

View File

@ -174,7 +174,7 @@ export class WindSpeedDirectionWidgetComponent implements OnInit, OnDestroy, Aft
this.windDirection = windDirectionTsValue[1]; this.windDirection = windDirectionTsValue[1];
if (!this.centerValueDataKey) { if (!this.centerValueDataKey) {
value = this.windDirection; value = this.windDirection;
this.centerValueText = formatValue(value, 0, '') + '°'; this.centerValueText = formatValue(value, 0, '', false) + '°';
} }
} }
} }
@ -182,7 +182,7 @@ export class WindSpeedDirectionWidgetComponent implements OnInit, OnDestroy, Aft
const centerValueTsValue = getSingleTsValueByDataKey(this.ctx.data, this.centerValueDataKey); const centerValueTsValue = getSingleTsValueByDataKey(this.ctx.data, this.centerValueDataKey);
if (centerValueTsValue && isDefinedAndNotNull(centerValueTsValue[1]) && isNumeric(centerValueTsValue[1])) { if (centerValueTsValue && isDefinedAndNotNull(centerValueTsValue[1]) && isNumeric(centerValueTsValue[1])) {
value = centerValueTsValue[1]; value = centerValueTsValue[1];
this.centerValueText = formatValue(value, this.decimals, '', true); this.centerValueText = formatValue(value, this.decimals, '', false);
} }
} }
this.centerValueColor.update(value); this.centerValueColor.update(value);