charts: minY/maxY

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

View File

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

View File

@ -25,6 +25,12 @@ const COLOR_BACK_CONSUME = "#ffc07a";
})
class EnergyCharts {
@Input()
maxY: number | undefined = undefined;
@Input()
minY: number | undefined = undefined;
private _offset!: number | null;
@Input()
@ -114,7 +120,7 @@ class EnergyCharts {
maintainAspectRatio: false,
animation: false,
scales: {
'x': {
x: {
type: 'time',
min: result.begin.getTime(),
max: result.end.getTime() - (this._interval?.inner?.millis || 0),
@ -133,8 +139,8 @@ class EnergyCharts {
bounds: 'ticks',
},
y: {
suggestedMax: 0.5,
suggestedMin: -0.1,
max: this.maxY,
min: this.minY,
}
},

View File

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

View File

@ -62,6 +62,12 @@ export class LocationEnergy implements OnInit, AfterViewInit, OnDestroy {
return this._o_;
}
@Input()
maxY: number | undefined = undefined;
@Input()
minY: number | undefined = undefined;
@Input()
interval!: Interval;