tengsx
2023-04-07 36c045a4f518f6506eab91e48ee48ce7d1aaa21d
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
<!--
 * @Author: shuishen 1109946754@qq.com
 * @Date: 2023-04-04 13:42:12
 * @LastEditors: shuishen 1109946754@qq.com
 * @LastEditTime: 2023-04-04 13:52:31
 * @FilePath: \hbsl\src\views\home\components\pieEcharts.vue
 * @Description:
 *
 * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved.
-->
<template>
    <div class="echarts-box" id="PieEcharts">
 
    </div>
</template>
 
<script>
export default {
    data () {
        return {
 
        }
    },
 
    mounted () {
        this.$nextTick(() => {
            this.initEcharts()
        })
    },
 
    methods: {
        initEcharts () {
            const that = this //注意,要将this进行指代,否则在click里面this指向发生了改变
            const myChart = this.$echarts.init(document.getElementById('PieEcharts'))
            // 指定图表的配置项和数据
            var option = {
                title: {
                    text: '常见问题',
                    left: 'center'
                },
                tooltip: {
                    trigger: 'item'
                },
                series: [
                    {
                        name: '问题原因',
                        type: 'pie',
                        radius: '50%',
                        data: [
                            { value: 1023, name: '解约失败' },
                            { value: 735, name: '等待银行扣款结果中' },
                            { value: 580, name: '解锁失败' },
                            { value: 484, name: '接口数据错误' },
                            { value: 300, name: '页面加载失败' }
                        ],
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.3)'
                            }
                        }
                    }
                ]
            }
 
            myChart.setOption(option)
        },
 
    },
}
</script>
 
<style lang="scss" scoped>
.echarts-box {
    width: 100%;
    height: 100%;
}
</style>