fix chart sizes after page switch

Signed-off-by: Stefan Dej <meteyou@gmail.com>
This commit is contained in:
Stefan Dej committed 2021-03-19 10:08:31 +01:00
1 parent 88d1debd73
commit f43a6d9c37
3 files changed
+12 -3

No files matched your search

@@ -1,5 +1,5 @@
<template>
<div id="historyAllPrintStatus" style="height: 250px; width: 100%;"></div>
<div id="historyAllPrintStatus" style="height: 250px; width: 100%;" v-observe-visibility="visibilityChanged"></div>
</template>
<script>
@@ -45,6 +45,9 @@ export default {
},
},
methods: {
visibilityChanged (isVisible) {
if(isVisible && this.chart !== null) this.chart.resize()
},
createChart() {
if (document.getElementById("historyAllPrintStatus") && this.chart === null) {
this.chart = echarts.init(document.getElementById("historyAllPrintStatus"), null, { renderer: 'svg' })
@@ -1,5 +1,5 @@
<template>
<div id="historyFilamentUsage" style="height: 175px; width: 100%;"></div>
<div id="historyFilamentUsage" style="height: 175px; width: 100%;" v-observe-visibility="visibilityChanged"></div>
</template>
<script>
@@ -114,6 +114,9 @@ export default {
},
},
methods: {
visibilityChanged (isVisible) {
if(isVisible && this.chart !== null) this.chart.resize()
},
createChart() {
if (document.getElementById("historyFilamentUsage") && this.chart === null) {
this.chart = echarts.init(document.getElementById("historyFilamentUsage"), null, { renderer: 'canvas' })
@@ -1,5 +1,5 @@
<template>
<div id="historyPrinttimeAvg" style="height: 175px; width: 100%;"></div>
<div id="historyPrinttimeAvg" style="height: 175px; width: 100%;" v-observe-visibility="visibilityChanged"></div>
</template>
<script>
@@ -91,6 +91,9 @@ export default {
},
},
methods: {
visibilityChanged (isVisible) {
if(isVisible && this.chart !== null) this.chart.resize()
},
createChart() {
if (document.getElementById("historyPrinttimeAvg") && this.chart === null) {
this.chart = echarts.init(document.getElementById("historyPrinttimeAvg"), null, { renderer: 'canvas' })