Slice color-tuning
This commit is contained in:
parent
4b857b9338
commit
b6ae6db00b
@ -91,9 +91,9 @@ export class Value {
|
|||||||
if (this.value === null) {
|
if (this.value === null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
if (Math.round(this.value) < middle) {
|
if (this.value < middle) {
|
||||||
return smallColor;
|
return smallColor;
|
||||||
} else if (Math.round(this.value) < high) {
|
} else if (this.value < high) {
|
||||||
return middleColor;
|
return middleColor;
|
||||||
}
|
}
|
||||||
return highColor;
|
return highColor;
|
||||||
|
|||||||
@ -8,10 +8,18 @@ import {Slice} from "../../../api/series/consumption/slice/Slice";
|
|||||||
import {Interval} from "../../../api/series/consumption/interval/Interval";
|
import {Interval} from "../../../api/series/consumption/interval/Interval";
|
||||||
import {ELECTRICITY_GRID_DELIVERED_ENERGY, ELECTRICITY_GRID_PURCHASED_ENERGY, ELECTRICITY_PHOTOVOLTAIC_PRODUCED} from "../../../api/series/constants";
|
import {ELECTRICITY_GRID_DELIVERED_ENERGY, ELECTRICITY_GRID_PURCHASED_ENERGY, ELECTRICITY_PHOTOVOLTAIC_PRODUCED} from "../../../api/series/constants";
|
||||||
|
|
||||||
const PURCHASING_MUCH = 200;
|
|
||||||
|
|
||||||
const PRODUCED_BEFORE_METER_CHANGE = new ValueConstant(287.995, "kWh");
|
const PRODUCED_BEFORE_METER_CHANGE = new ValueConstant(287.995, "kWh");
|
||||||
|
|
||||||
|
const ELECTRICITY_GRID_PURCHASED_FEW = 7.7;
|
||||||
|
|
||||||
|
const ELECTRICITY_GRID_PURCHASED_MUCH = 9.7;
|
||||||
|
|
||||||
|
const ELECTRICITY_GRID_POWER_MUCH = 400;
|
||||||
|
|
||||||
|
const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW = 0.7;
|
||||||
|
|
||||||
|
const ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH = 2;
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
selector: 'app-dashboard-electricity-tile',
|
selector: 'app-dashboard-electricity-tile',
|
||||||
standalone: true,
|
standalone: true,
|
||||||
@ -65,7 +73,6 @@ export class DashboardElectricityTileComponent {
|
|||||||
const consumptionPower = this.seriesCacheService.photovoltaicPower.plus(this.seriesCacheService.gridPower).clampNonNegative();
|
const consumptionPower = this.seriesCacheService.photovoltaicPower.plus(this.seriesCacheService.gridPower).clampNonNegative();
|
||||||
|
|
||||||
const gridColor = this.getGridPowerColor();
|
const gridColor = this.getGridPowerColor();
|
||||||
const productionColor = this.getProductionPowerColor();
|
|
||||||
|
|
||||||
const selfToday = this.producedToday.minus(this.deliveredToday);
|
const selfToday = this.producedToday.minus(this.deliveredToday);
|
||||||
const consumedToday = this.purchasedToday.plus(selfToday);
|
const consumedToday = this.purchasedToday.plus(selfToday);
|
||||||
@ -79,20 +86,20 @@ export class DashboardElectricityTileComponent {
|
|||||||
new DisplayValue('Produziert', this.seriesCacheService.photovoltaicProduced, ''),
|
new DisplayValue('Produziert', this.seriesCacheService.photovoltaicProduced, ''),
|
||||||
new DisplayValue('Selbst verbraucht', selfConsumed, ''),
|
new DisplayValue('Selbst verbraucht', selfConsumed, ''),
|
||||||
'Leistung',
|
'Leistung',
|
||||||
new DisplayValue('Produktion', this.seriesCacheService.photovoltaicPower, productionColor),
|
new DisplayValue('Produktion', this.seriesCacheService.photovoltaicPower, this.seriesCacheService.photovoltaicPower.color(50, 200, 'red', 'orange', 'green')),
|
||||||
new DisplayValue('Netz', this.seriesCacheService.gridPower, gridColor),
|
new DisplayValue('Netz', this.seriesCacheService.gridPower, gridColor),
|
||||||
new DisplayValue('Verbrauch', consumptionPower, ''),
|
new DisplayValue('Verbrauch', consumptionPower, ''),
|
||||||
'Heute',
|
'Heute',
|
||||||
new DisplayValue('Produziert', this.producedToday, ''),
|
new DisplayValue('Produziert', this.producedToday, this.producedToday.color(ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW, ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH, 'red', 'orange', 'green')),
|
||||||
new DisplayValue('Eingespeist', this.deliveredToday, ''),
|
new DisplayValue('Eingespeist', this.deliveredToday, ''),
|
||||||
new DisplayValue('Selbstverbraucht', selfToday, ''),
|
new DisplayValue('Selbstverbraucht', selfToday, ''),
|
||||||
new DisplayValue('Bezogen', this.purchasedToday, ''),
|
new DisplayValue('Bezogen', this.purchasedToday, this.purchasedToday.color(ELECTRICITY_GRID_PURCHASED_FEW, ELECTRICITY_GRID_PURCHASED_MUCH, 'green')),
|
||||||
new DisplayValue('Verbraucht', consumedToday, ''),
|
new DisplayValue('Verbraucht', consumedToday, ''),
|
||||||
'Gestern',
|
'Gestern',
|
||||||
new DisplayValue('Produziert', this.producedYesterday, ''),
|
new DisplayValue('Produziert', this.producedYesterday, this.producedYesterday.color(ELECTRICITY_PHOTOVOLTAIC_PRODUCED_FEW, ELECTRICITY_PHOTOVOLTAIC_PRODUCED_MUCH, 'red', 'orange', 'green')),
|
||||||
new DisplayValue('Eingespeist', this.deliveredYesterday, ''),
|
new DisplayValue('Eingespeist', this.deliveredYesterday, ''),
|
||||||
new DisplayValue('Selbstverbraucht', selfYesterday, ''),
|
new DisplayValue('Selbstverbraucht', selfYesterday, ''),
|
||||||
new DisplayValue('Bezogen', this.purchasedYesterday, ''),
|
new DisplayValue('Bezogen', this.purchasedYesterday, this.purchasedYesterday.color(ELECTRICITY_GRID_PURCHASED_FEW, ELECTRICITY_GRID_PURCHASED_MUCH, 'green')),
|
||||||
new DisplayValue('Verbraucht', consumedYesterday, ''),
|
new DisplayValue('Verbraucht', consumedYesterday, ''),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -104,7 +111,7 @@ export class DashboardElectricityTileComponent {
|
|||||||
return 'magenta';
|
return 'magenta';
|
||||||
}
|
}
|
||||||
|
|
||||||
const purchasingMuch = this.seriesCacheService.gridPower.value > PURCHASING_MUCH;
|
const purchasingMuch = this.seriesCacheService.gridPower.value > ELECTRICITY_GRID_POWER_MUCH;
|
||||||
if (purchasingMuch) {
|
if (purchasingMuch) {
|
||||||
return 'red';
|
return 'red';
|
||||||
}
|
}
|
||||||
@ -119,17 +126,4 @@ export class DashboardElectricityTileComponent {
|
|||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
private getProductionPowerColor() {
|
|
||||||
if (this.seriesCacheService.photovoltaicPower === null || this.seriesCacheService.photovoltaicPower.value === null) {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
const producingAny = this.seriesCacheService.photovoltaicPower.value > 0;
|
|
||||||
if (producingAny) {
|
|
||||||
return 'green';
|
|
||||||
}
|
|
||||||
|
|
||||||
return 'black';
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user