From 0128831423022feb4e46de456d6db216d538a2c3 Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Sun, 21 Feb 2021 22:26:44 +0100 Subject: [PATCH] bugfix: disable rendering of tempchart, when dashboard is not focused Signed-off-by: Stefan Dej --- src/components/charts/TempChart.vue | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/src/components/charts/TempChart.vue b/src/components/charts/TempChart.vue index 539b8d28..25ade18b 100644 --- a/src/components/charts/TempChart.vue +++ b/src/components/charts/TempChart.vue @@ -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)