Some visual tweaks in the energy view

This commit is contained in:
Michael Zanetti 2022-06-22 18:07:55 +02:00
parent db64033d56
commit 908b805606
6 changed files with 34 additions and 20 deletions

View File

@ -400,7 +400,6 @@ Page {
Layout.fillHeight: true
alignment: app.landscape ? Qt.Horizontal : Qt.Vertical
checked: index === swipeView.currentIndex
height: tabBar.height
// anchors.verticalCenter: parent.verticalCenter
text: model.displayName
iconSource: "../images/" + model.icon + ".svg"

View File

@ -15,7 +15,7 @@ Item {
Rectangle {
id: blurSource
anchors.fill: toolTip
anchors.fill: parent
color: Style.backgroundColor
visible: false
radius: Style.smallCornerRadius
@ -27,10 +27,10 @@ Item {
}
FastBlur {
anchors.fill: toolTip
anchors.fill: parent
source: blurSource
radius: 32
visible: toolTip.visible
visible: root.visible
}
Rectangle {

View File

@ -53,7 +53,9 @@ ChartView {
consumersSummation += consumers.get(i).stateByName("currentPower").value
}
d.consumersSummation = consumersSummation;
d.unknownSlice.value = Math.max(0, energyManager.currentPowerConsumption - consumersSummation)
if (d.unknownSlice) {
d.unknownSlice.value = Math.max(0, energyManager.currentPowerConsumption - consumersSummation)
}
}
}
@ -84,8 +86,9 @@ ChartView {
var consumer = consumers.get(i)
let currentPowerState = consumer.stateByName("currentPower")
let slice = consumersBalanceSeries.append(consumer.name, currentPowerState.value)
// slice.color = root.colors[i % root.colors.length]
slice.color = NymeaUtils.generateColor(Style.generationBaseColor, i)
slice.borderWidth = 0
slice.borderColor = slice.color
colorMap[consumer] = slice.color
currentPowerState.valueChanged.connect(function() {
slice.value = currentPowerState.value
@ -99,6 +102,8 @@ ChartView {
print("Unknown consumption:", unknownConsumption, "consumption balance", energyManager.currentPowerConsumption, "consumers summation:", consumersSummation)
d.unknownSlice = consumersBalanceSeries.append(qsTr("Unknown"), unknownConsumption)
d.unknownSlice.color = Style.gray
d.unknownSlice.borderColor = Style.gray
d.unknownSlice.borderWidth = 0
}
d.thingsColorMap = colorMap
@ -230,6 +235,4 @@ ChartView {
name: "down"
visible: !centerLayout.atYEnd
}
}

View File

@ -38,22 +38,26 @@ ChartView {
PieSlice {
color: Style.red
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: consumptionBalanceSeries.fromGrid
}
PieSlice {
color: Style.green
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: consumptionBalanceSeries.fromProduction
}
PieSlice {
color: Style.orange
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: consumptionBalanceSeries.fromStorage
}
PieSlice {
color: Style.backgroundColor
borderColor: Style.foregroundColor
color: Style.tileBackgroundColor
borderColor: color
borderWidth: 0
value: consumptionBalanceSeries.fromGrid == 0 && consumptionBalanceSeries.fromProduction == 0 && consumptionBalanceSeries.fromStorage == 0 ? 1 : 0
}
}

View File

@ -37,22 +37,26 @@ ChartView {
PieSlice {
color: Style.red
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: productionBalanceSeries.toConsumers
}
PieSlice {
color: Style.green
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: productionBalanceSeries.toGrid
}
PieSlice {
color: Style.orange
borderColor: Style.foregroundColor
borderColor: color
borderWidth: 0
value: productionBalanceSeries.toStorage
}
PieSlice {
color: Style.backgroundColor
borderColor: Style.foregroundColor
color: Style.tooltipBackgroundColor
borderColor: color
borderWidth: 0
value: productionBalanceSeries.toConsumers == 0 && productionBalanceSeries.toGrid == 0 && productionBalanceSeries.toStorage == 0 ? 1 : 0
}
}

View File

@ -100,10 +100,14 @@ StatsBase {
valueAxis.adjustMax(production)
}
var acquisition = root.energyManager.totalAcquisition - (start ? start.totalAcquisition : 0)
d.acquisitionSet.replace(d.acquisitionSet.count - 1, acquisition)
if (d.acquisitionSet) {
d.acquisitionSet.replace(d.acquisitionSet.count - 1, acquisition)
}
valueAxis.adjustMax(acquisition)
var ret = root.energyManager.totalReturn - (start ? start.totalReturn : 0)
d.returnSet.replace(d.returnSet.count - 1, ret)
if (d.returnSet) {
d.returnSet.replace(d.returnSet.count - 1, ret)
}
valueAxis.adjustMax(ret)
}
}