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

View File

@ -86,6 +86,6 @@
</div> </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> </div>

View File

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