zhongrj
2026-06-02 0299e41c6692684d943b4a206472a86ea84ea4b5
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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
//公共水球图组件
<template>
    <div class="echart-box" :id="elementId"></div>
</template>
<script>
import { fontSize } from "@/utils/fontSize.js"
 
export default {
    data () {
        return {
            elementId: ''
        }
    },
 
    props: {
        params: {
            type: Object
        }
    },
 
    created () {
        this.elementId = this.uuid()
    },
 
    mounted () {
        this.$nextTick(() => {
            this.initEcharts()
        })
    },
 
    methods: {
        uuid () {
            return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
                var r = Math.random() * 16 | 0,
                    v = c == 'x' ? r : (r & 0x3 | 0x8)
                return v.toString(16)
            })
        },
 
        initEcharts () {
            const that = this
            const myChart = that.$echarts.init(document.getElementById(that.elementId), null, { renderer: 'svg' })
 
            let option = {
                title: {
                    text: '60%',
                    textStyle: {
                        fontFamily: 'Microsoft Yahei',
                        fontWeight: 'normal',
                        color: '#fff',
                        fontSize: 16,
                    },
                    subtext: "+46dafds",
                    subtextStyle: {
                        color: '#fff',
                        fontSize: 14
                    },
                    itemGap: 1,
                    x: 'center',
                    y: '32%'
                },
 
                series: [
                    {
                        type: 'liquidFill',
                        radius: '80%',
                        data: [0.6, 0.6, 0.6],
                        backgroundStyle: {
                            color: {
                                type: 'radial',
                                x: 0.5,
                                y: 0.5,
                                r: 0.5,
                                colorStops: [
                                    {
                                        offset: 0,
                                        color: 'rgba(0,24,55, 0)',
                                    },
                                    {
                                        offset: 0.75,
                                        color: 'rgba(0,24,55, 0)',
                                    },
                                    {
                                        offset: 1,
                                        color: 'rgba(37,237,259, 1)',
                                    },
                                ],
                                globalCoord: false,
                            },
                        },
                        outline: {
                            borderDistance: 0,
                            itemStyle: {
                                borderWidth: 0,
                                borderColor: {
                                    type: 'linear',
                                    x: 0,
                                    y: 0,
                                    x2: 0,
                                    y2: 1,
                                    colorStops: [
                                        {
                                            offset: 0,
                                            color: 'rgba(50,115,256, 1)',
                                        },
                                        {
                                            offset: 0.5,
                                            color: 'rgba(50,115,233, .75)',
                                        },
                                        {
                                            offset: 1,
                                            color: 'rgba(50,115,233, 1)',
                                        },
                                    ],
                                    globalCoord: false,
                                },
                            },
                        },
                        color: {
                            type: 'linear',
                            x: 0,
                            y: 0,
                            x2: 0,
                            y2: 1,
                            colorStops: [
                                {
                                    offset: 0,
                                    color: 'rgba(37,237,259, 1)',
                                },
                                {
                                    offset: 0.5,
                                    color: 'rgba(0,100,259, 0.5)',
                                },
                                {
                                    offset: 1,
                                    color: 'darkblue',
                                },
                            ],
                            globalCoord: false,
                        },
                        label: {
                            normal: {
                                formatter: '',
                            },
                        },
                    }
                ]
            }
 
            myChart.setOption(option)
        }
    }
}
</script>
<style lang="scss" scoped>
.echart-box {
    width: 80px;
    height: 80px;
}
</style>