<template>
    <div id="mark-prog-pie"></div>
</template>
<script>
import elementResizeDetectorMaker from "element-resize-detector"
export default {
    data() {
        return {
            techScoreGau: undefined,
            option: {
                // title: {
                //     text: '阅卷进度',
                //     left: 'center',
                //     textStyle: {
                //         color: '#ddd',
                //         fontSize: 12
                //     }
                // },
                tooltip: {
                    trigger: 'item',
                    // formatter: '{a} <br/>{b} : {c} ({d}%)'
                    formatter: '{b} : {c} ({d}%)'
                },
                legend: {
                    top: 10,
                    itemWidth: 10,
                    itemHeight: 10,
                    left: 'center',
                    data: ['已阅', '进行中', '未阅'],
                    textStyle: {
                        color: '#ddd',
                        fontSize: 11,
                    },
                },
                series: [
                    {
                        type: 'pie',
                        radius: '75%',
                        center: ['50%', '60%'],
                        selectedMode: 'single',
                        data: [
                            {
                                value: 510,
                                name: '已阅',
                                itemStyle: {
                                    color: "#9ff080"
                                },
                            },
                            {
                                value: 434,
                                name: '进行中',
                                itemStyle: {
                                    color: "#5c7bd9"
                                },
                            },
                            {
                                value: 335,
                                name: '未阅',
                                itemStyle: {
                                    color: "#ffdc60"
                                },
                            }
                        ],

                        label: {
                            show: false
                        },
                        emphasis: {
                            itemStyle: {
                                shadowBlur: 10,
                                shadowOffsetX: 0,
                                shadowColor: 'rgba(0, 0, 0, 0.5)'
                            }
                        }
                    }
                ]
            }
        }
    },
    mounted() {
        this.techScoreGau = this.$echarts.init(document.getElementById('mark-prog-pie'))
        this.techScoreGau.setOption(this.option)
        this.erd = elementResizeDetectorMaker()
        this.erd.listenTo(document.getElementById("mark-prog-pie"), () => {
            this.$nextTick(() => {
                //监听到事件后执行的业务逻辑
                this.techScoreGau.resize()
            })
        })
    }
}
</script>
<style lang="less" scoped>
#mark-prog-pie {
    width: 400px;
    height: 200px;
}
</style>
<style>
</style>