Fix energy view when there is no root meter
This commit is contained in:
parent
e0066ef9fa
commit
7e8bcc7842
@ -54,7 +54,10 @@ Item {
|
|||||||
var series = d.thingsSeriesMap[consumer.id];
|
var series = d.thingsSeriesMap[consumer.id];
|
||||||
series.upperSeries.append(timestamp, totalValue)
|
series.upperSeries.append(timestamp, totalValue)
|
||||||
}
|
}
|
||||||
|
thingPowerLogs.maxValue = Math.max(thingPowerLogs.maxValue, totalValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
property double maxValue: 0
|
||||||
}
|
}
|
||||||
|
|
||||||
property PowerBalanceLogs powerBalanceLogs: PowerBalanceLogs {
|
property PowerBalanceLogs powerBalanceLogs: PowerBalanceLogs {
|
||||||
@ -172,7 +175,7 @@ Item {
|
|||||||
ValueAxis {
|
ValueAxis {
|
||||||
id: valueAxis
|
id: valueAxis
|
||||||
min: 0
|
min: 0
|
||||||
max: Math.ceil(powerBalanceLogs.maxValue / 1000) * 1000
|
max: Math.ceil(Math.max(powerBalanceLogs.maxValue, thingPowerLogs.maxValue) / 1000) * 1000
|
||||||
labelFormat: ""
|
labelFormat: ""
|
||||||
gridLineColor: Style.tileOverlayColor
|
gridLineColor: Style.tileOverlayColor
|
||||||
labelsVisible: false
|
labelsVisible: false
|
||||||
|
|||||||
@ -18,6 +18,9 @@ ChartView {
|
|||||||
property ThingsProxy consumers: null
|
property ThingsProxy consumers: null
|
||||||
property var colors: null
|
property var colors: null
|
||||||
|
|
||||||
|
readonly property Thing rootMeter: engine.thingManager.fetchingData ? null : engine.thingManager.things.getThing(energyManager.rootMeterId)
|
||||||
|
onRootMeterChanged: updateConsumers()
|
||||||
|
|
||||||
Connections {
|
Connections {
|
||||||
target: engine.thingManager
|
target: engine.thingManager
|
||||||
onFetchingDataChanged: {
|
onFetchingDataChanged: {
|
||||||
@ -80,8 +83,10 @@ ChartView {
|
|||||||
unknownConsumption -= currentPowerState.value
|
unknownConsumption -= currentPowerState.value
|
||||||
}
|
}
|
||||||
|
|
||||||
d.unknownSlice = consumersBalanceSeries.append(qsTr("Unknown"), unknownConsumption)
|
if (root.rootMeter) {
|
||||||
d.unknownSlice.color = Style.gray
|
d.unknownSlice = consumersBalanceSeries.append(qsTr("Unknown"), unknownConsumption)
|
||||||
|
d.unknownSlice.color = Style.gray
|
||||||
|
}
|
||||||
|
|
||||||
d.thingsColorMap = colorMap
|
d.thingsColorMap = colorMap
|
||||||
|
|
||||||
@ -109,6 +114,7 @@ ChartView {
|
|||||||
ColumnLayout {
|
ColumnLayout {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
spacing: 0
|
spacing: 0
|
||||||
|
visible: root.rootMeter
|
||||||
Label {
|
Label {
|
||||||
text: qsTr("Total")
|
text: qsTr("Total")
|
||||||
font: Style.smallFont
|
font: Style.smallFont
|
||||||
|
|||||||
Reference in New Issue
Block a user