Compare commits
No commits in common. "59b9a5f44ff01a3520649c8580045dc1ceffa046" and "2c663149418e217e51426ea5f364438baee53bef" have entirely different histories.
59b9a5f44f
...
2c66314941
@ -6,7 +6,6 @@
|
||||
@consumption: orange;
|
||||
@purchase: orangered;
|
||||
@production: dodgerblue;
|
||||
@cistern: #0760ff;
|
||||
@self: forestgreen;
|
||||
@delivery: magenta;
|
||||
|
||||
@ -47,10 +46,6 @@
|
||||
color: @delivery;
|
||||
}
|
||||
|
||||
.cistern {
|
||||
color: @cistern;
|
||||
}
|
||||
|
||||
.zero {
|
||||
filter: opacity(20%);
|
||||
}
|
||||
|
||||
@ -4,7 +4,7 @@ import {map, Subscription} from 'rxjs';
|
||||
import {StompService} from '@stomp/ng2-stompjs';
|
||||
import {FromJson, Next} from './types';
|
||||
|
||||
const DEV_TO_PROD = true;
|
||||
const DEV_TO_PROD = false;
|
||||
|
||||
@Injectable({
|
||||
providedIn: 'root'
|
||||
|
||||
@ -24,27 +24,27 @@
|
||||
<div class="numberTable">
|
||||
<div class="content">
|
||||
<div class="entry consumption" [class.zero]="aggregations.energyConsumed?.zero">
|
||||
<div class="name">Verbraucht</div>
|
||||
<div class="name">Bedarf</div>
|
||||
<div class="percent"> </div>
|
||||
<div class="value">{{ aggregations.energyConsumed?.formatted }}</div>
|
||||
</div>
|
||||
<div class="entry purchase" [class.zero]="aggregations.energyPurchased?.delta?.zero">
|
||||
<div class="name">Bezogen</div>
|
||||
<div class="name">Bezug</div>
|
||||
<div class="percent">{{ aggregations.energyPurchasedPercent?.formatted }}</div>
|
||||
<div class="value">{{ aggregations.energyPurchased?.delta?.formatted }}</div>
|
||||
</div>
|
||||
<div class="entry production" [class.zero]="aggregations.energyProduced?.delta?.zero">
|
||||
<div class="name">Produziert</div>
|
||||
<div class="name">Produktion</div>
|
||||
<div class="percent">{{ aggregations.energyProducedPercent?.formatted }}</div>
|
||||
<div class="value">{{ aggregations.energyProduced?.delta?.formatted }}</div>
|
||||
</div>
|
||||
<div class="entry self" [class.zero]="aggregations.energySelf?.zero">
|
||||
<div class="name">Selbst verbr.</div>
|
||||
<div class="name">Eigenbedarf</div>
|
||||
<div class="percent">{{ aggregations.energySelfPercent?.formatted }}</div>
|
||||
<div class="value">{{ aggregations.energySelf?.formatted }}</div>
|
||||
</div>
|
||||
<div class="entry delivery" [class.zero]="aggregations.energyDelivered?.delta?.zero">
|
||||
<div class="name">Eingespeist</div>
|
||||
<div class="name">Einspeisung</div>
|
||||
<div class="percent">{{ aggregations.energyDeliveredPercent?.formatted }}</div>
|
||||
<div class="value">{{ aggregations.energyDelivered?.delta?.formatted }}</div>
|
||||
</div>
|
||||
@ -54,11 +54,11 @@
|
||||
</div>
|
||||
</app-tile>
|
||||
|
||||
<app-tile *ngIf="alignment.inner">
|
||||
<app-tile>
|
||||
<div tile-head>
|
||||
Zisterne
|
||||
</div>
|
||||
<div tile-body>
|
||||
<img width="100%" *ngIf="seriesService.cisternVolume.series" [src]="seriesService.graph(seriesService.cisternVolume.series, 600, 200, alignment, offset, alignment.inner, 1)" [alt]="seriesService.cisternVolume.series.title">
|
||||
<img width="100%" *ngIf="seriesService.cisternVolume.series" [src]="seriesService.graph(seriesService.cisternVolume.series, 600, 200, alignment, offset, alignment.inner,1)" [alt]="seriesService.cisternVolume.series.title">
|
||||
</div>
|
||||
</app-tile>
|
||||
|
||||
@ -6,15 +6,23 @@
|
||||
|
||||
<div tile-body>
|
||||
|
||||
<div class="numberTable">
|
||||
<div class="content">
|
||||
<div class="entry cistern">
|
||||
<div class="name">Volumen</div>
|
||||
<div class="percent">{{ seriesService.cisternVolume.series?.lastValue?.percent(2000)?.localeString }} %</div>
|
||||
<div class="value">{{ seriesService.cisternVolume.series?.lastValue?.localeString }} {{ seriesService.cisternVolume.series?.unit?.unit }}</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<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">
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
<div class="numberTable">
|
||||
<div class="content">
|
||||
<div class="entry consumption" [class.zero]="powerConsumption?.zero">
|
||||
<div class="name">Verbrauch</div>
|
||||
<div class="name">Bedarf</div>
|
||||
<div class="percent"> </div>
|
||||
<div class="value">{{ powerConsumption?.formatted }}</div>
|
||||
</div>
|
||||
@ -23,7 +23,7 @@
|
||||
<div class="value">{{ powerProduction?.formatted }}</div>
|
||||
</div>
|
||||
<div class="entry self" [class.zero]="powerSelf?.zero">
|
||||
<div class="name">Eigenverbrauch</div>
|
||||
<div class="name">Eigenbedarf</div>
|
||||
<div class="percent">{{ powerSelfPercent?.formatted }}</div>
|
||||
<div class="value">{{ powerSelf?.formatted }}</div>
|
||||
</div>
|
||||
@ -34,9 +34,8 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<app-percent-bar [produktion]="powerProduction" [self]="powerSelf" [purchase]="powerPurchase" [delivery]="powerDelivery"></app-percent-bar>
|
||||
|
||||
</div>
|
||||
|
||||
<app-percent-bar [produktion]="powerProduction" [self]="powerSelf" [purchase]="powerPurchase" [delivery]="powerDelivery"></app-percent-bar>
|
||||
|
||||
</app-tile>
|
||||
|
||||
@ -1,7 +1,6 @@
|
||||
package de.ph87.data.series.graph;
|
||||
|
||||
import de.ph87.data.series.Aligned;
|
||||
import de.ph87.data.series.Alignment;
|
||||
import de.ph87.data.series.SeriesDto;
|
||||
import de.ph87.data.series.SeriesType;
|
||||
import de.ph87.data.value.Autoscale;
|
||||
@ -25,9 +24,6 @@ public class Graph {
|
||||
@NonNull
|
||||
public final SeriesDto series;
|
||||
|
||||
@NonNull
|
||||
public final Alignment innerAlignment;
|
||||
|
||||
@NonNull
|
||||
public final Aligned begin;
|
||||
|
||||
@ -66,11 +62,10 @@ public class Graph {
|
||||
|
||||
public final int maxLabelWidth;
|
||||
|
||||
public final Autoscale autoscale;
|
||||
private final Autoscale autoscale;
|
||||
|
||||
public Graph(@NonNull final SeriesDto series, @NonNull final List<GraphPoint> points, @NonNull final Alignment innerAlignment, @NonNull final Aligned begin, @NonNull final Aligned end, final int width, final int height, final int border) {
|
||||
public Graph(@NonNull final SeriesDto series, @NonNull final List<GraphPoint> points, @NonNull final Aligned begin, @NonNull final Aligned end, final int width, final int height, final int border) {
|
||||
this.series = series;
|
||||
this.innerAlignment = innerAlignment;
|
||||
this.begin = begin;
|
||||
this.end = end;
|
||||
this.width = width;
|
||||
@ -107,7 +102,7 @@ public class Graph {
|
||||
minuteMin = begin.date.toEpochSecond() / 60;
|
||||
minuteMax = end.date.toEpochSecond() / 60;
|
||||
minuteRange = minuteMax - minuteMin;
|
||||
minuteScale = (double) widthInner / (minuteRange + innerAlignment.maxDuration.toMinutes());
|
||||
minuteScale = (double) widthInner / (minuteRange + begin.alignment.maxDuration.toMinutes());
|
||||
|
||||
valueMin = vMin;
|
||||
valueMax = vMax;
|
||||
@ -137,7 +132,7 @@ public class Graph {
|
||||
|
||||
g.setColor(Color.WHITE);
|
||||
if (series.type == SeriesType.METER) {
|
||||
final int space = (int) (minuteScale * innerAlignment.maxDuration.toMinutes());
|
||||
final int space = (int) (minuteScale * begin.alignment.maxDuration.toMinutes());
|
||||
final int width = (int) (space * 0.95);
|
||||
for (final Point point : points) {
|
||||
g.fillRect(point.x + (space - width), 0, width, point.y);
|
||||
|
||||
@ -29,7 +29,6 @@ public class GraphController {
|
||||
final Alignment innerAlignment = Alignment.valueOf(innerAlignmentName);
|
||||
final Aligned end = outerAlignment.align(ZonedDateTime.now()).plus(1).minus(offset);
|
||||
final Aligned begin = end.minus(duration);
|
||||
log.warn("Graph: outer={}, offset={}, duration={}, begin={}, end={}, inner={}", outerAlignment, offset, duration, begin.date.toLocalDateTime(), end.date.toLocalDateTime(), innerAlignment);
|
||||
final Graph graph = graphService.getGraph(seriesId, innerAlignment, begin, end, width, height, 10);
|
||||
final BufferedImage image = graph.draw();
|
||||
response.setContentType("image/png");
|
||||
|
||||
@ -31,7 +31,7 @@ public class GraphService {
|
||||
case METER -> meterService.getPoints(series, innerAlignment, begin, end);
|
||||
case VARYING -> varyingService.getPoints(series, innerAlignment, begin, end);
|
||||
};
|
||||
return new Graph(series, entries, innerAlignment, begin, end, width, height, border);
|
||||
return new Graph(series, entries, begin, end, width, height, border);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -80,8 +80,8 @@ public class MeterService {
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public List<GraphPoint> getPoints(@NonNull final SeriesDto series, @NonNull final Alignment alignment, @NonNull final Aligned begin, @NonNull final Aligned end) {
|
||||
final List<? extends MeterValue> graphPoints = findRepository(alignment).findAllByIdMeterSeriesIdAndIdDateGreaterThanEqualAndIdDateLessThanEqualOrderByIdDate(series.id, begin.date, end.date);
|
||||
public List<GraphPoint> getPoints(@NonNull final SeriesDto series, @NonNull final Alignment innerAlignment, @NonNull final Aligned begin, @NonNull final Aligned end) {
|
||||
final List<? extends MeterValue> graphPoints = findRepository(innerAlignment).findAllByIdMeterSeriesIdAndIdDateGreaterThanEqualAndIdDateLessThanEqualOrderByIdDate(series.id, begin.date, end.date);
|
||||
final List<GraphPoint> points = graphPoints.stream().map(meterValue -> new GraphPoint(meterValue.getId().getDate(), meterValue.getMax() - meterValue.getMin())).collect(Collectors.toCollection(LinkedList::new));
|
||||
for (int i = 0; i < points.size() - 1; i++) {
|
||||
if (points.get(i).date.compareTo(points.get(i + 1).date) == 0) {
|
||||
|
||||
@ -73,7 +73,6 @@ public class VaryingService {
|
||||
|
||||
@NonNull
|
||||
public List<GraphPoint> getPoints(@NonNull final SeriesDto series, @NonNull final Alignment innerAlignment, @NonNull final Aligned begin, @NonNull final Aligned end) {
|
||||
log.info("getPoints: innerAlignment={}, begin={}, end={}", innerAlignment, begin, end);
|
||||
return findRepository(innerAlignment)
|
||||
.findAllByIdSeriesIdAndIdDateGreaterThanEqualAndIdDateLessThanEqual(series.id, begin.date, end.date)
|
||||
.stream()
|
||||
|
||||
Loading…
Reference in New Issue
Block a user