소스 검색

refactor(portraitRadar): 优化雷达图样式与进度条配色

1.  调整进度条使用传入的item.color作为渐变色和端点颜色
2.  修改雷达图配置:扩大半径、调整中心位置、增加分割线数量,优化轴标签样式与分割线配色
3.  简化系列配置,移除冗余注释并优化交互显示逻辑
huoyi@samsundot.com 3 주 전
부모
커밋
5088b43979
1개의 변경된 파일23개의 추가작업 그리고 55개의 파일을 삭제
  1. 23 55
      src/views/portraitManagement/components/ProfileRadar.vue

+ 23 - 55
src/views/portraitManagement/components/ProfileRadar.vue

@@ -7,11 +7,11 @@
7 7
           <span class="item-label">{{ item.name }}</span>
8 8
           <div class="progress-row">
9 9
             <div class="progress-bar">
10
-              <div class="progress-fill"
11
-                :style="{ width: ((item.finalScore || 0) / (computedMaxScore || 1) * 100) + '%', background: '#2babeb' }">
12
-                <span class="progress-end" :style="{ background: '#2babeb' }"></span>
13
-              </div>
10
+            <div class="progress-fill"
11
+              :style="{ width: ((item.finalScore || 0) / (computedMaxScore || 1) * 100) + '%', background: `linear-gradient(90deg, ${item.color}33, ${item.color})` }">
12
+                <span class="progress-end" :style="{ background: item.color }"></span>
14 13
             </div>
14
+          </div>
15 15
             <span class="item-value">{{ item.finalScore || 0 }}</span>
16 16
           </div>
17 17
         </div>
@@ -59,7 +59,7 @@ const computedIndicators = computed(() => {
59 59
   const allScores = data.map(item => item.finalScore || 0)
60 60
   const maxValue = allScores.length > 0 ? Math.max(...allScores) : 100
61 61
   return data.map(item => ({
62
-    name: item.name,
62
+    name: item.name + '\n\n' + (item.finalScore || 0),
63 63
     max: Math.max(maxValue, 1)
64 64
   }))
65 65
 })
@@ -98,30 +98,15 @@ const updateRadarChart = () => {
98 98
     },
99 99
     radar: {
100 100
       indicator: indicators,
101
-      center: ['50%', '50%'],
102
-      radius: '60%',
103
-      splitNumber: 4,
104
-      axisLine: {
105
-        lineStyle: {
106
-          color: 'rgba(255, 255, 255, 0.1)'
107
-        }
108
-      },
109
-      splitArea: {
110
-        show: true,
111
-        areaStyle: {
112
-          color: ['transparent', 'transparent', 'transparent', 'transparent', 'transparent']
113
-        }
114
-      },
115
-      splitLine: {
116
-        lineStyle: {
117
-          color: 'rgba(255, 255, 255, 0.1)'
118
-        }
119
-      },
120
-      name: {
121
-        textStyle: {
122
-          color: '#a0c4ff',
123
-          fontSize: 11
124
-        }
101
+      center: ['50%', '52%'],
102
+      radius: '50%',
103
+      splitNumber: 8,
104
+      axisLine: { lineStyle: { color: '#ccc' } },
105
+      splitLine: { lineStyle: { color: ['#ccc', '#ccc', '#ccc', '#ccc', '#ccc', '#ccc', '#fe4322', '#8EC742', '#ccc'], width: 3 } },
106
+      splitArea: { show: false },
107
+      axisName: {
108
+        color: '#fff',
109
+        fontSize: 13
125 110
       }
126 111
     },
127 112
     series: [
@@ -133,39 +118,22 @@ const updateRadarChart = () => {
133 118
           {
134 119
             value: pointValues,
135 120
             name: '综合得分',
136
-            // areaStyle: {
137
-            //   color: 'rgba(189, 3, 251, 0)'
138
-            // },
139 121
             opacity: 0,
140 122
             lineStyle: {
141 123
               color: '#4DC8FE',
142 124
               width: 2
143
-
144 125
             },
145 126
             itemStyle: { color: '#fff', borderWidth: 1, borderColor: '#00C8DA', borderJoin: 'round' }
146
-            // itemStyle: {
147
-            //   color: 'transparent'
148
-            // }
149 127
           }
150
-        ]
151
-      },
152
-      // ...(pointValues.length > 0 ? [
153
-      //   {
154
-      //     type: 'scatter',
155
-      //     coordinateSystem: 'radar',
156
-      //     data: pointValues.map((_, i) => {
157
-      //       const arr = new Array(pointValues.length).fill(null)
158
-      //       arr[i] = pointValues[i]
159
-      //       return { value: arr }
160
-      //     }),
161
-      //     symbol: 'circle',
162
-      //     symbolSize: 22,
163
-      //     itemStyle: {
164
-      //       color: ({ dataIndex }) => pointColors[dataIndex]
165
-      //     },
166
-      //     z: 10
167
-      //   }
168
-      // ] : [])
128
+        ],
129
+        label: {
130
+          show: false,
131
+          formatter: (p) => p.value,
132
+          color: '#fff',
133
+          fontSize: 16,
134
+          fontWeight: 'bold'
135
+        }
136
+      }
169 137
     ],
170 138
     tooltip: {
171 139
       trigger: 'item',