Merge PR #949: Fix energy return in chart when there are no producers
This commit is contained in:
commit
7ef8e54f7e
@ -335,7 +335,7 @@ Item {
|
|||||||
|
|
||||||
|
|
||||||
function calculateValue(entry) {
|
function calculateValue(entry) {
|
||||||
return Math.max(0, -entry.production) - Math.max(0, -entry.acquisition) - Math.max(0, entry.storage)
|
return Math.max(0, Math.max(0, -entry.production) - Math.max(0, -entry.acquisition) - Math.max(0, entry.storage))
|
||||||
}
|
}
|
||||||
|
|
||||||
function addEntry(entry) {
|
function addEntry(entry) {
|
||||||
@ -354,7 +354,7 @@ Item {
|
|||||||
borderWidth: 0
|
borderWidth: 0
|
||||||
borderColor: color
|
borderColor: color
|
||||||
opacity: d.selectedSeries == null || d.selectedSeries == toStorageSeries ? 1 : 0.3
|
opacity: d.selectedSeries == null || d.selectedSeries == toStorageSeries ? 1 : 0.3
|
||||||
visible: root.batteries.count > 0
|
// visible: root.batteries.count > 0
|
||||||
name: qsTr("To battery")
|
name: qsTr("To battery")
|
||||||
|
|
||||||
onClicked: d.selectSeries(toStorageSeries)
|
onClicked: d.selectSeries(toStorageSeries)
|
||||||
@ -393,9 +393,11 @@ Item {
|
|||||||
return toStorageSeries.calculateValue(entry) + Math.max(0, -entry.acquisition)
|
return toStorageSeries.calculateValue(entry) + Math.max(0, -entry.acquisition)
|
||||||
}
|
}
|
||||||
function addEntry(entry) {
|
function addEntry(entry) {
|
||||||
|
print("Adding return entry:", calculateValue(entry))
|
||||||
returnUpperSeries.append(entry.timestamp.getTime(), calculateValue(entry))
|
returnUpperSeries.append(entry.timestamp.getTime(), calculateValue(entry))
|
||||||
}
|
}
|
||||||
function insertEntry(index, entry) {
|
function insertEntry(index, entry) {
|
||||||
|
print("Adding return entry:", entry.acquisition, Math.max(0, -entry.acquisition), toStorageSeries.calculateValue(entry), calculateValue(entry))
|
||||||
returnUpperSeries.insert(index, entry.timestamp.getTime(), calculateValue(entry))
|
returnUpperSeries.insert(index, entry.timestamp.getTime(), calculateValue(entry))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user