Compare commits
2 Commits
d7ee5062e4
...
b6dfdd5686
| Author | SHA1 | Date | |
|---|---|---|---|
| b6dfdd5686 | |||
| 6aac9b2662 |
@ -1,6 +1,7 @@
|
||||
import {Routes} from '@angular/router';
|
||||
import {ElectroComponent} from './electro/electro.component';
|
||||
import {GreenhouseComponent} from './greenhouse/greenhouse/greenhouse.component';
|
||||
import {CisternComponent} from './cistern/cistern.component';
|
||||
|
||||
export class Path {
|
||||
|
||||
@ -20,7 +21,8 @@ export class Path {
|
||||
|
||||
export const ROUTING = {
|
||||
ENERGY: new Path('Energy', 'Energie', true),
|
||||
GREENHOUSE: new Path('Greenhouse', 'Gewächshaus', true),
|
||||
CISTERN: new Path('CISTERN', 'Zisterne', true),
|
||||
GREENHOUSE: new Path('Greenhouse', 'Gewächshaus', false),
|
||||
}
|
||||
|
||||
export function menubar(): Path[] {
|
||||
@ -29,6 +31,7 @@ export function menubar(): Path[] {
|
||||
|
||||
export const routes: Routes = [
|
||||
{path: ROUTING.ENERGY.path, component: ElectroComponent},
|
||||
{path: ROUTING.CISTERN.path, component: CisternComponent},
|
||||
{path: ROUTING.GREENHOUSE.path, component: GreenhouseComponent},
|
||||
{path: '**', redirectTo: ROUTING.ENERGY.path},
|
||||
];
|
||||
|
||||
18
src/main/angular/src/app/cistern/cistern.component.html
Normal file
18
src/main/angular/src/app/cistern/cistern.component.html
Normal file
@ -0,0 +1,18 @@
|
||||
<table class="vertical">
|
||||
<tr>
|
||||
<th>Füllgrad</th>
|
||||
<td class="valueInteger">{{ seriesService.cisternHeight.series?.lastValue?.percent(93.5)?.localeString }}</td>
|
||||
<td class="unit">%</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Füllhöhe</th>
|
||||
<td class="valueInteger">{{ seriesService.cisternHeight.series?.lastValue?.localeString }}</td>
|
||||
<td class="unit">{{ seriesService.cisternHeight.series?.lastValue?.unit?.unit }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Volumen</th>
|
||||
<td class="valueInteger">{{ seriesService.cisternVolume.series?.lastValue?.localeString }}</td>
|
||||
<td class="unit">{{ seriesService.cisternVolume.series?.lastValue?.unit?.unit }}</td>
|
||||
</tr>
|
||||
</table>
|
||||
<img width="100%" *ngIf="seriesService.cisternVolume.series" [src]="graph(seriesService.cisternVolume.series)" [alt]="seriesService.cisternVolume.series.title">
|
||||
37
src/main/angular/src/app/cistern/cistern.component.ts
Normal file
37
src/main/angular/src/app/cistern/cistern.component.ts
Normal file
@ -0,0 +1,37 @@
|
||||
import {Component, OnDestroy, OnInit} from '@angular/core';
|
||||
import {SeriesService} from '../series/series.service';
|
||||
import {Subscription} from 'rxjs';
|
||||
import {NgIf} from '@angular/common';
|
||||
import {Series} from '../series/Series';
|
||||
import {ApiService} from '../core/api.service';
|
||||
|
||||
@Component({
|
||||
selector: 'app-cistern',
|
||||
imports: [
|
||||
NgIf
|
||||
],
|
||||
templateUrl: './cistern.component.html',
|
||||
styleUrl: './cistern.component.less'
|
||||
})
|
||||
export class CisternComponent implements OnInit, OnDestroy {
|
||||
|
||||
private subs: Subscription[] = [];
|
||||
|
||||
constructor(
|
||||
readonly seriesService: SeriesService,
|
||||
) {
|
||||
}
|
||||
|
||||
ngOnInit(): void {
|
||||
this.subs.push(this.seriesService.subscribeAny());
|
||||
}
|
||||
|
||||
ngOnDestroy(): void {
|
||||
this.subs.forEach(sub => sub.unsubscribe());
|
||||
}
|
||||
|
||||
graph(series: Series) {
|
||||
return ApiService.url('http', ['Series', 'Graph', series.id, '400', '100', 'FIVE', '0', '288']);
|
||||
}
|
||||
|
||||
}
|
||||
@ -28,6 +28,10 @@ export class SeriesService extends AbstractRepositoryService {
|
||||
|
||||
readonly greenhouseIlluminance: SeriesWrapper = new SeriesWrapper("greenhouse/illuminance", this.onSubscribe, this.onUnsubscribe);
|
||||
|
||||
readonly cisternHeight: SeriesWrapper = new SeriesWrapper("Cistern/height", this.onSubscribe, this.onUnsubscribe);
|
||||
|
||||
readonly cisternVolume: SeriesWrapper = new SeriesWrapper("Cistern/volume", this.onSubscribe, this.onUnsubscribe);
|
||||
|
||||
protected get liveValues(): SeriesWrapper[] {
|
||||
return [
|
||||
this.powerConsumed,
|
||||
@ -38,6 +42,8 @@ export class SeriesService extends AbstractRepositoryService {
|
||||
this.greenhouseHumidityRelative,
|
||||
this.greenhouseHumidityAbsolute,
|
||||
this.greenhouseIlluminance,
|
||||
this.cisternHeight,
|
||||
this.cisternVolume,
|
||||
];
|
||||
}
|
||||
|
||||
|
||||
@ -36,6 +36,10 @@ export class Unit {
|
||||
|
||||
static readonly LIGHT_BOOLEAN = new Unit('LIGHT_BOOLEAN', '');
|
||||
|
||||
static readonly VOLUME_L = new Unit('VOLUME_L', 'l');
|
||||
|
||||
static readonly LENGTH_CM = new Unit('LENGTH_CM', 'cm');
|
||||
|
||||
private constructor(
|
||||
readonly name: string,
|
||||
readonly unit: string,
|
||||
|
||||
@ -1,17 +1,19 @@
|
||||
package de.ph87.data.series.graph;
|
||||
|
||||
import de.ph87.data.series.*;
|
||||
import de.ph87.data.value.*;
|
||||
import jakarta.annotation.*;
|
||||
import lombok.*;
|
||||
import de.ph87.data.series.Aligned;
|
||||
import de.ph87.data.series.SeriesDto;
|
||||
import de.ph87.data.series.SeriesType;
|
||||
import de.ph87.data.value.Autoscale;
|
||||
import jakarta.annotation.Nullable;
|
||||
import lombok.NonNull;
|
||||
|
||||
import java.awt.*;
|
||||
import java.awt.geom.*;
|
||||
import java.awt.image.*;
|
||||
import java.awt.geom.Line2D;
|
||||
import java.awt.image.BufferedImage;
|
||||
import java.util.List;
|
||||
import java.util.function.*;
|
||||
import java.util.function.Function;
|
||||
|
||||
import static java.lang.Math.*;
|
||||
import static java.lang.Math.max;
|
||||
|
||||
public class Graph {
|
||||
|
||||
@ -117,14 +119,14 @@ public class Graph {
|
||||
final Graphics2D g = (Graphics2D) image.getGraphics();
|
||||
final int fontH3_4 = (int) Math.round(g.getFontMetrics().getHeight() * 0.75);
|
||||
|
||||
g.setColor(Color.gray);
|
||||
final String string = "%s [%s]".formatted(series.getTitle(), autoscale.unit);
|
||||
g.drawString(string, border, border + fontH3_4);
|
||||
// g.setColor(Color.gray);
|
||||
// final String string = "%s [%s]".formatted(series.getTitle(), autoscale.unit);
|
||||
// g.drawString(string, border, border + fontH3_4);
|
||||
|
||||
yLabel(g, valueMax, DASHED, Color.red);
|
||||
yLabel(g, valueAvg, DASHED, new Color(0, 127, 0));
|
||||
yLabel(g, valueMax, DASHED, Color.red.darker().darker());
|
||||
// yLabel(g, valueAvg, DASHED, new Color(0, 127, 0));
|
||||
yLabel(g, 0, NORMAL, Color.BLACK);
|
||||
yLabel(g, valueMin, DASHED, Color.blue);
|
||||
yLabel(g, valueMin, DASHED, new Color(64, 128, 255).darker().darker());
|
||||
|
||||
g.translate(border, height - border);
|
||||
g.scale(1, -1);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user