diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts index db3bc5559d..46ec39c3be 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/analogue-gauge.models.ts @@ -64,9 +64,13 @@ export interface AnalogueGaugeSettings { animationRule: AnimationRule; } +interface BaseGaugeModel extends BaseGauge { + _value?: number; +} + export abstract class TbBaseGauge { - private gauge: BaseGauge; + private gauge: BaseGaugeModel; protected constructor(protected ctx: WidgetContext, canvasId: string) { const gaugeElement = $('#' + canvasId, ctx.$container)[0]; @@ -77,16 +81,20 @@ export abstract class TbBaseGauge { protected abstract createGaugeOptions(gaugeElement: HTMLElement, settings: S): O; - protected abstract createGauge(gaugeData: O): BaseGauge; + protected abstract createGauge(gaugeData: O): BaseGaugeModel; update() { if (this.ctx.data.length > 0) { const cellData = this.ctx.data[0]; if (cellData.data.length > 0) { - const tvPair = cellData.data[cellData.data.length - - 1]; + const tvPair = cellData.data[cellData.data.length - 1]; const value = parseFloat(tvPair[1]); if (value !== this.gauge.value) { + if (!this.gauge.options.animation) { + this.gauge._value = value; + } else { + delete this.gauge._value; + } this.gauge.value = value; } } diff --git a/ui-ngx/src/app/modules/home/components/widget/lib/digital-gauge.ts b/ui-ngx/src/app/modules/home/components/widget/lib/digital-gauge.ts index ede5962922..cc5a3e08dd 100644 --- a/ui-ngx/src/app/modules/home/components/widget/lib/digital-gauge.ts +++ b/ui-ngx/src/app/modules/home/components/widget/lib/digital-gauge.ts @@ -26,7 +26,6 @@ import { prepareFontSettings } from '@home/components/widget/lib/settings.models import { CanvasDigitalGauge, CanvasDigitalGaugeOptions } from '@home/components/widget/lib/canvas-digital-gauge'; import { DatePipe } from '@angular/common'; import { IWidgetSubscription } from '@core/api/widget-api.models'; -import { Subscription } from 'rxjs'; import { ColorProcessor, createValueSubscription, ValueSourceType } from '@shared/models/widget-settings.models'; import GenericOptions = CanvasGauges.GenericOptions; @@ -260,6 +259,8 @@ export class TbCanvasDigitalGauge { if (value !== this.gauge.value) { if (!this.gauge.options.animation) { this.gauge._value = value; + } else { + delete this.gauge._value; } this.gauge.value = value; } else if (this.localSettings.showTimestamp && this.gauge.timestamp !== timestamp) {