wlqk.vue
1.73 KB
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
<template>
<div class="wlqk">
<div id="wlqk-myChart" class="chart"></div>
</div>
</template>
<script>
// 网络情况
export default {
name: "wlqk",
components: {},
data () {
return {
xAxisData: [],
wldkData: [],
wlzcData: [],
};
},
mounted () {
this.echartInit();
},
methods: {
echartInit () {
let _this = this;
// 基于准备好的dom,初始化echarts实例
let myChart = this.$echarts.init(
document.getElementById("wlqk-myChart")
);
// 绘制图表
myChart.setOption({
color: ["#ee9096", "#8fb657"],
legend: {
data: ["网络断开", "网络正常"],
top: 20,
},
xAxis: [
{
type: "category",
data: _this.xAxisData,
},
],
yAxis: [
{
type: "value",
},
],
series: [
{
name: "网络断开",
type: "bar",
data: _this.wldkData,
},
{
name: "网络正常",
type: "bar",
data: _this.wlzcData,
},
],
});
},
},
};
</script>
<style scoped lang="scss">
@import "./home.scss";
.wlqk {
width: 100%;
height: 100%;
.chart {
width: 100%;
height: 100%;
}
}
</style>