管道基础大数据平台系统开发-【前端】-新系統界面
1
Surpriseplus
2022-12-19 9c803f20cc05395bac2d3386accfe230210c07dc
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
<template>
  <div class="echart1_box">
    <div id="echart1"></div>
  </div>
</template>
 
<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return { myChart };
  },
  mounted() {
    this.lineChart();
    this.$bus.$on('resizeEchart', (res) => {
      this.myChart.resize();
    });
  },
  //方法集合
  methods: {
    lineChart() {
      let option = {
        title: {
          text: '数据更新量与分布总量',
          textStyle: {
            color: '#fff',
          },
        },
        tooltip: {
          trigger: 'axis',
          axisPointer: {
            type: 'cross',
            label: {
              backgroundColor: '#FFFFFF',
            },
          },
        },
        legend: {
          data: ['增量', '总量', 'Video Ads', 'Direct', 'Search Engine'],
        },
        toolbox: {
          feature: {
            saveAsImage: {},
          },
        },
        grid: {
          left: '3%',
          right: '4%',
          bottom: '3%',
          containLabel: true,
        },
        xAxis: [
          {
            axisLine: {
              lineStyle: {
                color: '#ccc',
              },
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
              },
            },
            type: 'category',
            boundaryGap: false,
            data: [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12],
          },
        ],
        yAxis: [
          {
            axisLine: {
              lineStyle: {
                color: '#ccc',
              },
            },
            axisLabel: {
              show: true,
              textStyle: {
                color: '#fff',
              },
            },
            type: 'value',
            boundaryGap: false,
          },
        ],
        series: [
          {
            name: '增量',
            type: 'line',
            stack: 'Total',
            areaStyle: {
              color: '#8F595A',
              opacity: 0.5,
            },
            emphasis: {
              focus: 'series',
            },
            data: [200, 300, 100, 500, 2000, 500, 200, 400, 100, 100, 80, 300],
          },
 
          {
            name: '总量',
            type: 'line',
            stack: 'Total',
            label: {
              show: true,
              position: 'top',
            },
            areaStyle: {
              color: '#02929E',
              opacity: 0.5,
            },
            emphasis: {
              focus: 'series',
            },
            data: [
              2048, 2051, 2052, 2057, 2077, 2082, 2084, 2088, 2089, 2090, 2090,
              2093,
            ],
          },
        ],
      };
      this.myChart = this.$echarts.init(document.getElementById('echart1'));
      this.myChart.setOption(option);
      window.addEventListener('resize', function () {
        this.myChart.resize();
      });
    },
  },
  created() {},
};
</script>
<style lang="less" scoped>
//@import url(); 引入公共css类
.echart1_box {
  padding: 20px;
  // background: rgba(0, 0, 0, 0.6);
}
#echart1 {
  width: 100%;
  height: 100%;
}
</style>