added missing refresh for energy-plot
This commit is contained in:
parent
d962dcefa9
commit
04be7692c1
@ -12,7 +12,7 @@
|
||||
Bezug
|
||||
</div>
|
||||
<div class="SectionBody COLOR_FONT_PURCHASE">
|
||||
{{ purchase.toValueString(interval ? null : now) }}
|
||||
{{ purchase.toValueString(null) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -21,7 +21,7 @@
|
||||
Solar
|
||||
</div>
|
||||
<div class="SectionBody COLOR_FONT_PRODUCE">
|
||||
{{ produce.toValueString(interval ? null : now) }}
|
||||
{{ produce.toValueString(null) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
Verbrauch
|
||||
</div>
|
||||
<div class="SectionBody COLOR_FONT_CONSUME">
|
||||
{{ consume.toValueString(interval ? null : now) }}
|
||||
{{ consume.toValueString(null) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@ -39,7 +39,7 @@
|
||||
Einspeisung
|
||||
</div>
|
||||
<div class="SectionBody COLOR_FONT_DELIVER">
|
||||
{{ deliver.toValueString(interval ? null : now) }}
|
||||
{{ deliver.toValueString(null) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@ -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 {Interval} from '../../../series/Interval';
|
||||
import {PointService} from '../../../point/point-service';
|
||||
import {PointResponse} from '../../../point/PointResponse';
|
||||
import {PointSeries} from '../../../point/PointSeries';
|
||||
import {EnergyPoint} from './EnergyPoint';
|
||||
import {Subscription, timer} from 'rxjs';
|
||||
|
||||
@Component({
|
||||
selector: 'app-energy-plot',
|
||||
@ -12,7 +13,7 @@ import {EnergyPoint} from './EnergyPoint';
|
||||
templateUrl: './energy-plot.html',
|
||||
styleUrl: './energy-plot.less',
|
||||
})
|
||||
export class EnergyPlot implements AfterViewInit {
|
||||
export class EnergyPlot implements OnInit, OnDestroy, AfterViewInit {
|
||||
|
||||
readonly widthPx = 800;
|
||||
|
||||
@ -44,12 +45,22 @@ export class EnergyPlot implements AfterViewInit {
|
||||
|
||||
protected xWidthPx: number = 0;
|
||||
|
||||
private readonly subs: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
readonly pointService: PointService,
|
||||
) {
|
||||
//
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.subs.push(timer(60000, 60000).subscribe(() => this.ngAfterViewInit()));
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subs.forEach(sub => sub.unsubscribe());
|
||||
}
|
||||
|
||||
ngAfterViewInit(): void {
|
||||
if (!this._location.energyPurchase) {
|
||||
return;
|
||||
@ -132,4 +143,5 @@ export class EnergyPlot implements AfterViewInit {
|
||||
this._count = value;
|
||||
this.ngAfterViewInit();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user