added missing refresh for energy-plot

This commit is contained in:
Patrick Haßel 2025-11-03 12:43:07 +01:00
parent d962dcefa9
commit 04be7692c1
2 changed files with 18 additions and 6 deletions

View File

@ -12,7 +12,7 @@
Bezug Bezug
</div> </div>
<div class="SectionBody COLOR_FONT_PURCHASE"> <div class="SectionBody COLOR_FONT_PURCHASE">
{{ purchase.toValueString(interval ? null : now) }} {{ purchase.toValueString(null) }}
</div> </div>
</div> </div>
@ -21,7 +21,7 @@
Solar Solar
</div> </div>
<div class="SectionBody COLOR_FONT_PRODUCE"> <div class="SectionBody COLOR_FONT_PRODUCE">
{{ produce.toValueString(interval ? null : now) }} {{ produce.toValueString(null) }}
</div> </div>
</div> </div>
@ -30,7 +30,7 @@
Verbrauch Verbrauch
</div> </div>
<div class="SectionBody COLOR_FONT_CONSUME"> <div class="SectionBody COLOR_FONT_CONSUME">
{{ consume.toValueString(interval ? null : now) }} {{ consume.toValueString(null) }}
</div> </div>
</div> </div>
@ -39,7 +39,7 @@
Einspeisung Einspeisung
</div> </div>
<div class="SectionBody COLOR_FONT_DELIVER"> <div class="SectionBody COLOR_FONT_DELIVER">
{{ deliver.toValueString(interval ? null : now) }} {{ deliver.toValueString(null) }}
</div> </div>
</div> </div>

View File

@ -1,10 +1,11 @@
import {AfterViewInit, Component, Input} from '@angular/core'; import {AfterViewInit, Component, Input, OnDestroy, OnInit} from '@angular/core';
import {Location} from '../../Location'; import {Location} from '../../Location';
import {Interval} from '../../../series/Interval'; import {Interval} from '../../../series/Interval';
import {PointService} from '../../../point/point-service'; import {PointService} from '../../../point/point-service';
import {PointResponse} from '../../../point/PointResponse'; import {PointResponse} from '../../../point/PointResponse';
import {PointSeries} from '../../../point/PointSeries'; import {PointSeries} from '../../../point/PointSeries';
import {EnergyPoint} from './EnergyPoint'; import {EnergyPoint} from './EnergyPoint';
import {Subscription, timer} from 'rxjs';
@Component({ @Component({
selector: 'app-energy-plot', selector: 'app-energy-plot',
@ -12,7 +13,7 @@ import {EnergyPoint} from './EnergyPoint';
templateUrl: './energy-plot.html', templateUrl: './energy-plot.html',
styleUrl: './energy-plot.less', styleUrl: './energy-plot.less',
}) })
export class EnergyPlot implements AfterViewInit { export class EnergyPlot implements OnInit, OnDestroy, AfterViewInit {
readonly widthPx = 800; readonly widthPx = 800;
@ -44,12 +45,22 @@ export class EnergyPlot implements AfterViewInit {
protected xWidthPx: number = 0; protected xWidthPx: number = 0;
private readonly subs: Subscription[] = [];
constructor( constructor(
readonly pointService: PointService, readonly pointService: PointService,
) { ) {
// //
} }
ngOnInit(): void {
this.subs.push(timer(60000, 60000).subscribe(() => this.ngAfterViewInit()));
}
ngOnDestroy(): void {
this.subs.forEach(sub => sub.unsubscribe());
}
ngAfterViewInit(): void { ngAfterViewInit(): void {
if (!this._location.energyPurchase) { if (!this._location.energyPurchase) {
return; return;
@ -132,4 +143,5 @@ export class EnergyPlot implements AfterViewInit {
this._count = value; this._count = value;
this.ngAfterViewInit(); this.ngAfterViewInit();
} }
} }