<template>
    <div id="scan-progress-box"></div>
</template>
<script>
import elementResizeDetectorMaker from "element-resize-detector"
export default {
    data() {
        return {
            techScoreGau: undefined,
            option: {
                title: [
                    {
                        text: '80',
                        x: '44%',
                        y: '27%',
                        textAlign: 'center',
                        textStyle: {
                            fontSize: '32',
                            fontWeight: '600',
                            color: '#ffffff',
                            textAlign: 'center',
                        },
                    },
                    {
                        text: '%',
                        x: '58%',
                        y: '38%',
                        textAlign: 'center',
                        textStyle: {
                            fontSize: '14',
                            fontWeight: '600',
                            color: '#ffffff',
                            textAlign: 'center',
                        },
                    },
                    {
                        text: '1000/1001',
                        x: '48%',
                        y: '58%',
                        textAlign: 'center',
                        textStyle: {
                            fontSize: '12',
                            fontWeight: '200',
                            color: '#0FF',
                            textAlign: 'center',
                        },
                    }
                ],
                polar: {
                    radius: ['90%', '75%'],
                    center: ['50%', '50%'],
                },
                angleAxis: {
                    max: 100,
                    show: false,
                },
                radiusAxis: {
                    type: 'category',
                    show: true,
                    axisLabel: {
                        show: false,
                    },
                    axisLine: {
                        show: false,

                    },
                    axisTick: {
                        show: false
                    },
                },
                series: [{
                    name: '',
                    type: 'bar',
                    roundCap: true,
                    barWidth: 60,
                    showBackground: true,
                    backgroundStyle: {
                        color: '#2e2856',
                    },
                    data: [80],
                    coordinateSystem: 'polar',
                    itemStyle: {
                        normal: {
                            color: new this.$echarts.graphic.LinearGradient(0, 1, 0, 0, [{
                                offset: 0,
                                color: '#585fe1'
                            }, {
                                offset: 1,
                                color: '#0ff'
                            }]),
                        }
                    }
                }
                ]
            }
        }
    },
    mounted() {
        this.techScoreGau = this.$echarts.init(document.getElementById('scan-progress-box'))
        this.techScoreGau.setOption(this.option)
        this.erd = elementResizeDetectorMaker()
        this.erd.listenTo(document.getElementById("scan-progress-box"), () => {
            this.$nextTick(() => {
                //监听到事件后执行的业务逻辑
                this.techScoreGau.resize()
            })
        })
    }
}
</script>
<style lang="less" scoped>
#scan-progress-box {
    width: 200px;
    height: 120px;
}
</style>
<style>
</style>