fixed formatting of card

This commit is contained in:
Ralf Bauer 2023-06-28 18:52:23 +02:00
parent 4b88413b4f
commit bf7be21c13
2 changed files with 17 additions and 4 deletions

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="card" v-if="dataLoaded"> <div class="card row" v-if="dataLoaded">
<GChart type="ColumnChart" :data="chartData" :options="chartOptions" /> <GChart type="ColumnChart" :data="chartData" :options="chartOptions" />
</div> </div>
</template> </template>
@ -19,7 +19,7 @@ const options_col = {
height: '80%' height: '80%'
}, },
bar: { bar: {
groupWidth: '100%' groupWidth: '90%'
}, },
legend: { legend: {
position: 'none' position: 'none'

View File

@ -1,5 +1,5 @@
<template> <template>
<div class="card" v-if="dataLoaded"> <div class="card row" v-if="dataLoaded">
<GChart type="Calendar" :data="chartData" :options="chartOptions" :settings="{ packages: ['calendar'] }" /> <GChart type="Calendar" :data="chartData" :options="chartOptions" :settings="{ packages: ['calendar'] }" />
</div> </div>
</template> </template>
@ -33,6 +33,7 @@ export default defineComponent({
}, },
created() { created() {
this.getInitialData(); this.getInitialData();
this.startautorefresh();
}, },
methods: { methods: {
getInitialData() { getInitialData() {
@ -52,7 +53,19 @@ export default defineComponent({
this.dataLoaded = true; this.dataLoaded = true;
} }
}) })
} },
callEveryHour() {
this.getInitialData();
setInterval(this.getInitialData, 1000 * 60 * 60); // refresh every hour
},
startautorefresh() {
var nextDate = new Date();
nextDate.setHours(nextDate.getHours() + 1);
nextDate.setMinutes(0);
nextDate.setSeconds(5);
var difference: number = nextDate.valueOf() - Date.now();
setTimeout(this.callEveryHour, difference);
},
} }
}); });
</script> </script>