管道基础大数据平台系统开发-【前端】-新系統界面
Surpriseplus
2022-11-11 2687d1deee158e4af3dc9aa624dc886d1a069e6d
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
<template>
  <div class="echart31_box">
    <div id="echart31"></div>
  </div>
</template>
 
<script>
export default {
  //import引入的组件需要注入到对象中才能使用
  components: {},
  data() {
    //这里存放数据
    return {};
  },
  mounted() {
    this.lineChart();
  },
  //方法集合
  methods: {
    lineChart() {
      let option = {
        title: {
          text: "项目类别",
          textStyle: {
            color: "#fff",
          },
        },
        tooltip: {
          trigger: "item",
        },
        legend: {
          top: "5%",
          right: "0",
          textStyle: {
            fontSize: 12,
            color: "#fff",
          },
        },
        series: [
          {
            name: "项目类别",
            type: "pie",
            radius: ["45%", "55%"],
            // avoidLabelOverlap: false,
            label: {
              formatter: "{b}:{c}",
              textStyle: {
                fontSize: 12,
                color: "#fff",
              },
            },
 
            labelLine: {
              //   show: false,
            },
            data: [
              { value: 2, name: "站场类" },
              { value: 5, name: "管道类" },
            ],
          },
        ],
      };
      let myChart = this.$echarts.init(document.getElementById("echart31"));
      myChart.setOption(option);
      window.addEventListener("resize", function () {
        myChart.resize();
      });
    },
  },
  created() {},
};
</script>
<style lang="less" scoped>
//@import url(); 引入公共css类
.echart31_box {
  padding: 20px;
  // background: rgba(0, 0, 0, 0.6);
}
#echart31 {
  width: 100%;
  height: 100%;
}
</style>