bugfix: disable rendering of tempchart, when dashboard is not focused

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-02-21 22:44:27 +01:00
1 parent ab79857fbe
commit 0128831423
1 file changed
+7 -14
+7 -14
View File
@@ -16,6 +16,7 @@ export default {
chart : null,
timerChart: '',
timerDataset: '',
chartFocus: false,
chartOptions: {
darkMode: true,
animation: false,
@@ -263,12 +264,15 @@ export default {
} else setTimeout(() => {
this.createChart()
}, 500)
}
},
},
created() {
this.timerChart = setInterval(() => {
if (this.chart) {
if (
this.chart &&
document.visibilityState === "visible" &&
this.$route.path === "/"
) {
this.chart.setOption({
series: this.series,
xAxis: {
@@ -277,18 +281,7 @@ export default {
},
yAxis: [{
max: this.autoscale ? this.currentMaxTemp : this.maxTemp,
//scale: this.autoscale
}],
/*media: [{
query: {
minWidth: 500,
},
option: {
xAxis: {
maxInterval: this.maxHistory * 1000 / 10
}
}
}],*/
})
}
}, this.intervalChartUpdate)