factor to calculate W from kWh

This commit is contained in:
Patrick Haßel 2025-11-20 16:59:25 +01:00
parent 5c2f9423d3
commit a94d80753a
4 changed files with 16 additions and 4 deletions

View File

@ -2,7 +2,7 @@
<app-location-power [location]="location"></app-location-power> <app-location-power [location]="location"></app-location-power>
<app-location-energy [location]="location" [interval]="Interval.DAY" [offset]="offsetDay" [maxY]="0.07" [minY]="-0.07"> <app-location-energy [location]="location" [interval]="Interval.DAY" [offset]="offsetDay" unit="⌀W" [factor]="12 * 1000" [maxY]="850" [minY]="-850">
<ng-content #SeriesHistoryHeading> <ng-content #SeriesHistoryHeading>
<div style="display: flex; width: 100%"> <div style="display: flex; width: 100%">
&nbsp; &nbsp;

View File

@ -25,6 +25,12 @@ const COLOR_BACK_CONSUME = "#ffc07a";
}) })
class EnergyCharts { class EnergyCharts {
@Input()
unit: string = "";
@Input()
factor: number = 1;
@Input() @Input()
maxY: number | undefined = undefined; maxY: number | undefined = undefined;
@ -99,9 +105,9 @@ class EnergyCharts {
categoryPercentage: 1.0, categoryPercentage: 1.0,
barPercentage: 0.95, barPercentage: 0.95,
data: pointSeries.points.map(p => { data: pointSeries.points.map(p => {
return {x: p[0] * 1000, y: p[1] * factor}; return {x: p[0] * 1000, y: p[1] * factor * this.factor};
}), }),
label: `${pointSeries.series.name} [${pointSeries.series.unit}]`, label: `${pointSeries.series.name} [${this.unit || pointSeries.series.unit}]`,
borderColor: color, borderColor: color,
backgroundColor: color, backgroundColor: color,
stack: stack ? stack : undefined, stack: stack ? stack : undefined,

View File

@ -86,6 +86,6 @@
</div> </div>
<app-energy-charts [location]="location" [interval]="interval" [offset]="offset" [maxY]="maxY" [minY]="minY"></app-energy-charts> <app-energy-charts [location]="location" [interval]="interval" [offset]="offset" [unit]="unit" [factor]="factor" [maxY]="maxY" [minY]="minY"></app-energy-charts>
</div> </div>

View File

@ -62,6 +62,12 @@ export class LocationEnergy implements OnInit, AfterViewInit, OnDestroy {
return this._o_; return this._o_;
} }
@Input()
unit: string = "";
@Input()
factor: number = 1;
@Input() @Input()
maxY: number | undefined = undefined; maxY: number | undefined = undefined;