基于廊坊系统为基础,国防科技大学系统演示Demo
surprise
2024-04-28 c310c155e3e91e6b285b3fb3519a3ef7c6690d66
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
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
<template>
    <div class="projectTime" ref="chart">
 
    </div>
</template>
<script>
import * as echarts from "echarts"
export default {
    data() {
        return {
 
        }
    },
    mounted() {
        this.initChart();
    },
    methods: {
        initChart() {
            var dataArr = 60;
            var colorSet = '#45CAED';
 
            var color = new echarts.graphic.LinearGradient(0, 0, 1, 0, [
                {
                    offset: 0,
                    color: '#8D00FF',
                },
                {
                    offset: 0.4,
                    color: '#0EBAFC',
                },
                {
                    offset: 1,
                    color: '#0EBAFC',
                },
            ]);
            var option = {
                title: {
                    text: '项目进度',
                    textStyle: {
                        color: '#7DAEEF',
                        fontSize: 12,
                    },
                    padding: 0,
                    top: '80%',
                    left: 'center',
                },
                xAxis: {
                    splitLine: {
                        show: false,
                    },
                    axisLabel: {
                        show: false,
                    },
                    axisLine: {
                        show: false,
                    },
                },
                yAxis: {
                    splitLine: {
                        show: false,
                    },
                    axisLabel: {
                        show: false,
                    },
                    axisLine: {
                        show: false,
                    },
                },
                series: [
                    // 刻度
                    {
                        type: 'gauge',
                        radius: '82%',
                        startAngle: 220,
                        endAngle: -40,
                        axisTick: {
                            show: true,
                            lineStyle: {
                                color: '#6B9DD7',
                                width: 1,
                            },
                            length: -8,
                        }, //刻度样式
                        splitLine: {
                            show: true,
                            lineStyle: {
                                color: '#6B9DD7',
                                width: 1,
                            },
                            length: -8,
                        }, //分隔线样式
                        axisLabel: {
                            color: 'rgba(255,255,255,0)',
                            fontSize: 12,
                        }, //刻度节点文字颜色
                        pointer: {
                            show: false,
                        },
                        axisLine: {
                            show: false,
                        },
                        label: {
                            show: false,
                        },
                        // //仪表盘详情,用于显示数据。
                        // detail: {
                        //     show: true,
                        //     offsetCenter: [0, '50%'],
                        //     color: '#ACCFFF',
                        //     formatter: function (params) {
                        //         return '当前速度';
                        //     },
                        //     textStyle: {
                        //         fontSize: 16,
                        //     },
                        // },
                    },
                    {
                        name: '内部进度条',
                        type: 'gauge',
                        center: ['50%', '50%'],
                        radius: '78%',
                        splitNumber: 10,
                        axisLine: {
                            lineStyle: {
                                color: [
                                    [dataArr / 100, color],
                                    [1, 'rgba(107,157,215,.25)'],
                                ],
                                width: 8,
                            },
                        },
                        z: 4,
                        axisLabel: {
                            show: false,
                        },
                        axisTick: {
                            show: false,
                        },
                        splitLine: {
                            show: false,
                        },
                        itemStyle: {
                            color: colorSet,
                        },
                        detail: {
                            show: false,
                        },
                        label: {
                            show: false,
                        },
 
                        title: {
                            //标题
                            show: true,
                            offsetCenter: [0, '35%'], // x, y,单位px
                            textStyle: {
                                color: '#ACCFFF',
                                fontSize: 16, //表盘上的标题文字大小
                                fontWeight: 400,
                                fontFamily: 'PingFangSC',
                            },
                        },
                        data: [
                            {
                                name: dataArr + '%',
                                value: dataArr,
                            },
                        ],
                        pointer: {
                            show: true,
                            length: '40%',
                            radius: '20%',
                            width: 4, //指针粗细
                        },
                    },
                    {
                        //指针上的圆
                        type: 'pie',
                        tooltip: {
                            show: false,
                        },
                        z: 5,
                        hoverAnimation: false,
                        legendHoverLink: false,
                        radius: ['0%', '6%'],
                        center: ['50%', '50%'],
                        label: {
                            normal: {
                                show: false,
                            },
                        },
                        labelLine: {
                            normal: {
                                show: false,
                            },
                        },
                        data: [
                            {
                                value: 10,
                                itemStyle: {
                                    normal: {
                                        color: colorSet,
                                    },
                                },
                            },
                        ],
                    },
                    // 外一层圈
                    {
                        type: 'pie',
                        radius: '60%',
                        startAngle: 220,
                        endAngle: -40,
                        hoverAnimation: false,
                        center: ['50%', '50%'],
                        avoidLabelOverlap: false,
                        label: {
                            show: false,
                        },
                        labelLine: {
                            show: false,
                        },
                        data: [
                            {
                                value: 1,
                            },
                        ],
                        itemStyle: {
                            normal: {
                                color: {
                                    type: 'linear',
                                    x: 0,
                                    y: 0,
                                    x2: 0,
                                    y2: 1,
                                    colorStops: [
                                        {
                                            offset: 0,
                                            color: '#17A1FF',
                                        },
                                        {
                                            offset: 1,
                                            color: 'rgba(17, 90, 233, 0.16)',
                                        },
                                    ],
                                },
                                opacity: 0.12,
                            },
                        },
                    },
                    // 内圆
                    {
                        type: 'pie',
                        radius: ['0', '50%'],
                        center: ['50%', '50%'],
                        hoverAnimation: false,
                        z: 3,
                        data: [
                            {
                                value: dataArr,
                                itemStyle: {
                                    normal: {
                                        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
                                            {
                                                offset: 0,
                                                color: '#23A6FF',
                                            },
                                            {
                                                offset: 1,
                                                color: 'rgba(17, 90, 233, 0.21)  ',
                                            },
                                        ]),
                                        opacity: 0.59,
                                    },
                                },
                                label: {
                                    show: false,
                                },
                            },
                        ],
                        labelLine: {
                            show: false,
                        },
                    },
                ],
            };
 
 
            const chart = echarts.init(this.$refs.chart)
 
            chart.setOption(option)
            window.addEventListener("resize", function () {
                chart.resize()
            })
        },
    },
}
 
</script>
<style  lang="scss">
.projectTime {
    height: calc(100% - 30px);
    width: 100%;
}
</style>