longyvfengyun
2023-12-25 d8d792a6842832e8f6af6604274c438b25053afe
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
<script>
import BaseChart from "./BaseChart";
export default {
  name: "NormalPie",
  extends: BaseChart,
  props: {
    unit: {
      type: String,
      default: "",
    }
  },
  data() {
    return {}
  },
  methods: {
    setData(data) {
      let option = this.getOption(data);
      this.setOption(option);
    },
    getOption(data) {
      let series = data && data.series?data.series:[{
        type: 'pie',
        radius: '65%',
        center: ['50%', '50%'],
        selectedMode: 'single',
        data: []
      }];
      return {
        animation: false,
        tooltip: {
          trigger: 'item',
        },
        legend: {
          bottom: 10,
          left: 'center',
        },
        series: series
      }
    }
  },
  mounted() {
    this.setData();
  }
}
</script>