bugfix: tempchart doestn't work after FW_RESTART

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej
2020-12-27 00:30:36 +01:00
parent 2323278b8e
commit 72f82504e9

View File

@@ -59,11 +59,20 @@ export default {
}
},
methods: {
createChart() {
if (document.getElementById("tempchart")) {
this.chart = new CanvasJS.Chart("tempchart", this.chartOptions)
} else setTimeout(() => {
this.createChart()
}, 500)
}
},
created() {
this.timer = setInterval(() => {
if (
document.getElementById("tempchart") &&
this.chart &&
this.chart._toolBar
) {
@@ -76,7 +85,7 @@ export default {
}, 1000);
},
mounted: function() {
this.chart = new CanvasJS.Chart("tempchart", this.chartOptions)
this.createChart()
}
}
</script>