Fix power balance chart when there's returned energy but no producer

This commit is contained in:
Michael Zanetti 2023-02-22 17:40:58 +01:00
parent d93f817d87
commit 233c146a8c

View File

@ -38,7 +38,7 @@ Item {
id: d id: d
function formatValue(value) { function formatValue(value) {
var ret var ret
if (value >= 1000) { if (Math.abs(value) >= 1000) {
ret = (value / 1000).toFixed(1) + "kW" ret = (value / 1000).toFixed(1) + "kW"
} else { } else {
ret = value.toFixed(1) + "W" ret = value.toFixed(1) + "W"
@ -121,7 +121,11 @@ Item {
if (root.toGrid > 0) { if (root.toGrid > 0) {
size = root.toGrid / biggest size = root.toGrid / biggest
drawDottedCurve(ctx, solarPos, gridPos, size, Style.yellow) if (producers.count > 0) {
drawDottedCurve(ctx, solarPos, gridPos, size, Style.yellow)
} else {
drawDottedCurve(ctx, consumptionPos, gridPos, size, Style.yellow)
}
} }
if (energyManager.currentPowerProduction < 0 && root.fromProduction) { if (energyManager.currentPowerProduction < 0 && root.fromProduction) {