jxdnsong
2022-10-25 bf5ba56e8a82f0ef699f2eae413d0dc2c4e4f67d
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<template>
    <div class="container">
        <div class="chart" ref="PipeWell_ref"></div>
    </div>
</template>
 
<script>
export default {
    data () {
 
        return {
            chartInstance: null,
            data: [
                { name: '给水管井', value: 20.62 },
                { name: '雨水管井', value: 18.56 },
                { name: '污水管井', value: 16.49 },
                { name: '供电管井', value: 17.11 },
                { name: '燃气管井', value: 11.55 },
                { name: '检查井', value: 15.67 },
            ]
        }
    },
    mounted () {
        this.initChart()
        this.updateChart()
    },
    methods: {
        initChart () {
            this.chartInstance = this.$echarts.init(this.$refs.PipeWell_ref)
        },
        getData () {
 
        },
        updateChart () {
            const pipe = this.data.map((item) => {
                return item.pipe
            })
            const long = this.data.map(item => {
                return item.long
            })
            const option = {
                title: {
                    show: true,
                    text: ['{a|▎}', '{b|管井占比}'],
                    left: 16,
                    top: 16,
                    textStyle: {
                        rich: {
                            a: {
                                color: '#28f2ff',
                                fontSize: 16,
                                weight: 400
                            },
                            b: {
                                color: '#fff',
                                fontSize: 16,
                                weight: 400
                            }
                        }
                    }
                },
                legend: {
                    type: 'scroll',
                    orient: 'vertical',
                    right: 30,
                    top: '15%',
                    textStyle: {
                        color: '#fff'
                    },
                    formatter: '{name}',
                    itemGap: 20
                },
                series: [
                    {
                        name: 'Nightingale Chart',
                        type: 'pie',
                        radius: [0, 100],
                        center: ['30%', '58%'],
                        data: this.data,
                        label: {
                            show: true,
                            position: 'inner',
                            fontSize: 12,
                            color: '#fff',
                            formatter: '{b}\n{d}%'
                        },
                    }
                ]
            }
            this.chartInstance.setOption(option)
        }
    }
}
</script>
 
<style lang="scss" scoped>
.container {
    width: 400px;
    height: 100%;
    background: url(/zhjg/img/home/juxing2.png) no-repeat;
    background-size: 100% 100%;
    .chart {
        width: 100%;
        height: 100%;
    }
}
</style>