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