中医药大学课题数据库系统
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

80 lines
1.8 KiB

<template>
<!-- <div>数据统计组件</div> -->
<div style="width: 100%; height: 300px" class="chart-box">
<div id="Treemap" style="height: 400px"></div>
</div>
</template>
<script>
export default {
name: 'Treemap',
data() {
return {
// msg: 'Welcome to Your Vue.js App',
width: '',
height: '',
timer: null,
};
},
mounted() {
this.drawLine();
this.timer = setInterval(() => {
this.drawLine();
}, 10000);
let wh = window.innerWidth;
let hg = window.innerHeight;
this.width = wh + 'px';
this.height = hg + 'px';
console.log(this.height);
window.onresize = () => {
return (() => {
wh = window.innerWidth;
hg = window.innerHeight;
this.width = wh + 'px';
this.height = hg + 'px';
})();
};
},
destroyed() {
clearInterval(this.timer);
},
methods: {
async drawLine() {
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(document.getElementById('Treemap'));
// 绘制图表
var option = {
title: {
left: 'center',
text: '每日病例统计',
},
series: [
{
type: 'treemap',
data: [
{
name: '未完成', // First tree
value: 50,
},
{
name: '已完成', // Second tree
value: 25,
},
{
name: '进行中', // Second tree
value: 10,
},
{
name: '废弃', // Second tree
value: 5,
},
],
},
],
};
myChart.setOption(option);
},
},
};
</script>
<style lang="stylus" scoped ></style>