Fix a crash in the charts when adding/removing things

This commit is contained in:
Michael Zanetti 2022-02-18 00:33:09 +01:00
parent c5c404f369
commit c3dbdb67d8
3 changed files with 9 additions and 1 deletions

View File

@ -76,6 +76,7 @@ ThingPageBase {
Layout.margins: Style.bigMargins
size: Style.largeIconSize
imageSource: "thermostat/heating"
color: Style.white
backgroundColor: app.interfaceToColor("heating")
visible: root.boostState
busy: actionQueue.pendingValue ? actionQueue.pendingValue : (root.boostState && root.boostState.value === true)

View File

@ -186,7 +186,7 @@ MainViewBase {
anchors.centerIn: parent
width: parent.width - app.margins * 2
visible: !engine.thingManager.fetchingData && (!engine.jsonRpcClient.experiences.hasOwnProperty("Energy") || engine.jsonRpcClient.experiences["Energy"] <= "0.1")
title: qsTr("Energy plugin not installed installed.")
title: qsTr("Energy plugin not installed.")
text: qsTr("This %1 system does not have the energy extensions installed.").arg(Configuration.systemName)
imageSource: "../images/smartmeter.svg"
buttonText: qsTr("Install energy plugin")

View File

@ -56,7 +56,10 @@ ChartView {
}
function updateConsumers() {
root.animationOptions = ChartView.NoAnimation
print("clearing consumers pie chart", consumersBalanceSeries.count)
consumersBalanceSeries.clear();
print("cleared consumers pie chart")
if (engine.thingManager.fetchingData) {
return;
@ -81,6 +84,10 @@ ChartView {
d.unknownSlice.color = Style.gray
d.thingsColorMap = colorMap
root.animationOptions = Qt.binding(function() {
return Qt.application.active ? NymeaUtils.chartsAnimationOptions : ChartView.NoAnimation
})
}
PieSeries {