From 5c2f9423d3584c67772765ee3d865f1719a66c70 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20Ha=C3=9Fel?= Date: Thu, 20 Nov 2025 16:37:07 +0100 Subject: [PATCH] charts: minY/maxY --- .../src/app/location/detail/location-detail.html | 2 +- .../src/app/location/energy/charts/energy-charts.ts | 12 +++++++++--- .../src/app/location/energy/location-energy.html | 2 +- .../src/app/location/energy/location-energy.ts | 6 ++++++ 4 files changed, 17 insertions(+), 5 deletions(-) diff --git a/src/main/angular/src/app/location/detail/location-detail.html b/src/main/angular/src/app/location/detail/location-detail.html index 6cffb5c..be22186 100644 --- a/src/main/angular/src/app/location/detail/location-detail.html +++ b/src/main/angular/src/app/location/detail/location-detail.html @@ -2,7 +2,7 @@ - +
  diff --git a/src/main/angular/src/app/location/energy/charts/energy-charts.ts b/src/main/angular/src/app/location/energy/charts/energy-charts.ts index 65ec6e0..eef2963 100644 --- a/src/main/angular/src/app/location/energy/charts/energy-charts.ts +++ b/src/main/angular/src/app/location/energy/charts/energy-charts.ts @@ -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, } }, diff --git a/src/main/angular/src/app/location/energy/location-energy.html b/src/main/angular/src/app/location/energy/location-energy.html index 66c175a..79ce66b 100644 --- a/src/main/angular/src/app/location/energy/location-energy.html +++ b/src/main/angular/src/app/location/energy/location-energy.html @@ -86,6 +86,6 @@
- + diff --git a/src/main/angular/src/app/location/energy/location-energy.ts b/src/main/angular/src/app/location/energy/location-energy.ts index 9e5679b..5183254 100644 --- a/src/main/angular/src/app/location/energy/location-energy.ts +++ b/src/main/angular/src/app/location/energy/location-energy.ts @@ -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;