LineChart Copy.vue
2.78 KB
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
<script setup lang="ts">
import { Descriptions, Progress, Skeleton, Tooltip, DescriptionsItem } from 'ant-design-vue';
defineProps({
seriesData: {
type: Array as PropType<Recordable[]>,
default: () => [],
},
});
</script>
<template>
<div class="m-16">
<Skeleton active :paragraph="{ rows: 10 }" :loading="!seriesData">
<Descriptions :column="1">
<template v-for="(item, index) in seriesData" :key="item.label">
<DescriptionsItem>
<span
class="mr-2 item-span"
:style="{
color:
index === 0
? '#f0a16e'
: index === 1
? '#868585'
: index === 2
? '#e78739'
: '#4e84f5',
backgroundColor:
index === 0 ? '#FAD672' : index === 1 ? '#CBCAC9' : index === 2 ? '#F1B889' : '',
borderColor:
index === 0
? '#fdee7d'
: index === 1
? '#e6e6e5'
: index === 2
? '#f8c296'
: '#0b55f1',
}"
>{{ index + 1 }}</span
>
<div class="flex justify-between" style="width: 100%">
<div class="label-span">
<Tooltip :title="item.label">
{{ item.label }}
</Tooltip>
</div>
<div class="flex w-7/10">
<Progress
:showInfo="false"
size="small"
style="width: 70%"
:percent="(item.value / seriesData[0].value) * 100"
:strokeWidth="12"
:strokeColor="
index === 0
? '#ea5b42'
: index === 1
? '#666'
: index === 2
? '#e4751a'
: '#b5b6b6'
"
/>
<span
class="ml-2"
:style="{ color: index === 0 ? '#EA5B42' : index === 2 ? '#E4751A' : '#666' }"
>
{{ item.value }}
</span>
</div>
</div>
</DescriptionsItem>
</template>
</Descriptions>
</Skeleton>
</div>
</template>
<style scoped lang="less">
.item-span {
width: 1.4rem;
height: 1.25rem;
border: 1px solid;
color: #0b55f1;
border-radius: 50%;
display: flex;
align-items: center;
justify-content: center;
}
.label-span {
width: 10rem;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
word-break: break-all;
}
</style>