Data2025/src/main/angular/src/app/location/graph/simple-plot.ts

71 lines
2.1 KiB
TypeScript

import {AfterViewInit, Component, Input} from '@angular/core';
import {Location} from '../Location';
import {Interval} from '../../series/Interval';
import {PointService} from '../../point/point-service';
@Component({
selector: 'app-series-history-graph',
imports: [],
templateUrl: './simple-plot.html',
styleUrl: './simple-plot.less',
})
export class SeriesHistoryGraph implements AfterViewInit {
protected segments = Array.from(Array(288).keys());
protected totals: number[] = [];
protected historyEnergyPurchase: number[] | null = null;
protected historyEnergyDeliver: number[] | null = null;
protected historyEnergyProduce: number[] | null = null;
protected readonly Interval = Interval;
@Input()
heading!: string;
@Input()
date!: Date;
@Input()
interval!: Interval;
@Input()
location!: Location;
constructor(
readonly pointService: PointService,
) {
//
}
ngAfterViewInit(): void {
// this.history(this.location?.energyPurchase, history => this.historyEnergyPurchase = history);
// this.history(this.location?.energyDeliver, history => this.historyEnergyDeliver = history);
// this.history(this.location?.energyProduce, history => this.historyEnergyProduce = history);
}
// public readonly updateSeries = (fresh: Series): void => {
// if (fresh.id === this.location?.energyPurchase?.id) {
// this.history(this.location?.energyPurchase, history => this.historyEnergyPurchase = history);
// }
// if (fresh.id === this.location?.energyDeliver?.id) {
// this.history(this.location?.energyDeliver, history => this.historyEnergyDeliver = history);
// }
// if (fresh.id === this.location?.energyProduce?.id) {
// this.history(this.location?.energyProduce, history => this.historyEnergyProduce = history);
// }
// };
//
// private history(series: Series | null | undefined, next: Next<number[] | null>) {
// if (!series || !this.interval) {
// next(null);
// return
// }
// this.pointService.points(series, this.date, this.interval, next);
// }
}