基于廊坊系统为基础,国防科技大学系统演示Demo
lixuliang
2024-04-30 7f0f5bc0be05b8a9206bcff083442379504db009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
<template>
  <div class="echart5_box">
    <div id="echart5"></div>
  </div>
</template>
 
<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return { myChart:null };
  },
  mounted() {
    this.lineChart();
    this.$bus.$on('resizeEchart', (res) => {
      this.myChart.resize();
    });
  },
  //方法集合
  methods: {
    lineChart() {
      let option = {
        title: {
          text: '各类数据占比',
          top:'15',
          textStyle: {
            color: '#fff',
          },
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            // Use axis to trigger tooltip
            type: 'shadow', // 'shadow' as default; can also be 'line' or 'shadow'
          },
        },
        legend: {
          top:30,
          right:0,
          textStyle: {
            color: '#fff',
          },
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true,
        },
        xAxis: {
          type: 'value',
          axisLabel: {
            color: '#fff',
          },
        },
        yAxis: {
          axisLabel: {
            color: '#fff',
          },
          type: 'category',
          data: ['勘察数据', '岩土数据', '测量数据', '合规数据', '管理数据'],
        },
        series: [
          {
            name: '存儲量',
            type: 'bar',
            stack: 'total',
            label: {
              show: true,
              textStyle: {
                color: '#fff',
              },
            },
            emphasis: {
              focus: 'series',
            },
            data: [122880, 40960, 153600, 5120, 28672],
          },
 
          {
            name: '总量',
            type: 'bar',
            stack: 'total',
            label: {
              show: true,
              textStyle: {
                color: '#fff',
              },
            },
            emphasis: {
              focus: 'series',
            },
            data: [351232, 351232, 351232, 351232, 351232],
          },
        ],
      };
      this.myChart = this.$echarts.init(document.getElementById('echart5'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },
  created() {},
};
</script>
<style lang="less" scoped>
//@import url(); 引入公共css类
.echart5_box {
   padding: 20px;
  width: 100%;
  height: 100%;
}
#echart5 {
  width: calc(100% - 40px);
  height: calc(100% - 40px);
}
</style>