Переглянути джерело

refactor(chart): 统一优化图表样式与布局

调整多处图表的图例配置、内边距和容器高度,优化展示效果;修正部门档案页面的得分标题文案,注释无用的原生图例布局代码
huoyi 1 тиждень тому
батько
коміт
9409954aaf

+ 6 - 1
src/pages/components/AreaDistribution.vue

@@ -50,11 +50,16 @@ export default {
50
           trigger: 'axis',
50
           trigger: 'axis',
51
           axisPointer: { type: 'shadow' }
51
           axisPointer: { type: 'shadow' }
52
         },
52
         },
53
+        legend: {
54
+          data: ['查获数量'],
55
+          textStyle: { color: '#666', fontSize: 10 },
56
+          top: 0
57
+        },
53
         grid: {
58
         grid: {
54
           left: '15%',
59
           left: '15%',
55
           right: '5%',
60
           right: '5%',
56
           bottom: '15%',
61
           bottom: '15%',
57
-          top: '10%'
62
+          top: '22%'
58
         },
63
         },
59
         xAxis: {
64
         xAxis: {
60
           type: 'category',
65
           type: 'category',

+ 7 - 1
src/pages/components/DailySeizureChart.vue

@@ -81,11 +81,16 @@ export default {
81
           trigger: 'axis',
81
           trigger: 'axis',
82
           axisPointer: { type: 'shadow' }
82
           axisPointer: { type: 'shadow' }
83
         },
83
         },
84
+        legend: {
85
+          data: ['查获总数'],
86
+          textStyle: { color: '#666', fontSize: 10 },
87
+          top: 0
88
+        },
84
         grid: {
89
         grid: {
85
           left: '10%',
90
           left: '10%',
86
           right: '5%',
91
           right: '5%',
87
           bottom: '18%',
92
           bottom: '18%',
88
-          top: '10%'
93
+          top: '22%'
89
         },
94
         },
90
         xAxis: {
95
         xAxis: {
91
           type: 'category',
96
           type: 'category',
@@ -166,6 +171,7 @@ export default {
166
           axisPointer: { type: 'shadow' }
171
           axisPointer: { type: 'shadow' }
167
         },
172
         },
168
         legend: {
173
         legend: {
174
+          type:'scroll',
169
           data: (this.chartsData.dept.deptData || []).map(d => d.name),
175
           data: (this.chartsData.dept.deptData || []).map(d => d.name),
170
           textStyle: {
176
           textStyle: {
171
             color: '#333',
177
             color: '#333',

+ 6 - 1
src/pages/components/InterceptionDistribution.vue

@@ -45,11 +45,16 @@ export default {
45
             const option = {
45
             const option = {
46
                 responsive: true,
46
                 responsive: true,
47
                 maintainAspectRatio: false,
47
                 maintainAspectRatio: false,
48
+                legend: {
49
+                    data: ['拦截数量'],
50
+                    textStyle: { color: '#666', fontSize: 10 },
51
+                    top: 0
52
+                },
48
                 grid: {
53
                 grid: {
49
                     left: '25%',
54
                     left: '25%',
50
                     right: '10%',
55
                     right: '10%',
51
                     bottom: '10%',
56
                     bottom: '10%',
52
-                    top: '10%'
57
+                    top: '22%'
53
                 },
58
                 },
54
                 xAxis: {
59
                 xAxis: {
55
                     type: 'value',
60
                     type: 'value',

+ 10 - 4
src/pages/components/ItemDistribution.vue

@@ -1,12 +1,12 @@
1
 <template>
1
 <template>
2
   <div class="item-distribution">
2
   <div class="item-distribution">
3
     <div class="chart-container" ref="itemChart"></div>
3
     <div class="chart-container" ref="itemChart"></div>
4
-    <div class="legend-grid">
4
+    <!-- <div class="legend-grid">
5
       <div v-for="(item, index) in chartsData.items" :key="index" class="legend-item">
5
       <div v-for="(item, index) in chartsData.items" :key="index" class="legend-item">
6
         <div class="legend-dot" :style="{ backgroundColor: item.color }"></div>
6
         <div class="legend-dot" :style="{ backgroundColor: item.color }"></div>
7
         <div class="legend-text">{{ item.name }}: {{ item.value }}</div>
7
         <div class="legend-text">{{ item.name }}: {{ item.value }}</div>
8
       </div>
8
       </div>
9
-    </div>
9
+    </div> -->
10
   </div>
10
   </div>
11
 </template>
11
 </template>
12
 
12
 
@@ -57,9 +57,15 @@ export default {
57
           trigger: 'item',
57
           trigger: 'item',
58
           formatter: '{b}: {c} ({d}%)'
58
           formatter: '{b}: {c} ({d}%)'
59
         },
59
         },
60
+        legend: {
61
+          type: 'scroll',
62
+          data: this.chartsData.items.map(item => item.name),
63
+          textStyle: { color: '#666', fontSize: 10 },
64
+          top: 0
65
+        },
60
         series: [{
66
         series: [{
61
           type: 'pie',
67
           type: 'pie',
62
-          radius: ['50%', '70%'],
68
+          radius: ['30%', '47%'],
63
           data: this.chartsData.items.map(item => ({
69
           data: this.chartsData.items.map(item => ({
64
             name: item.name,
70
             name: item.name,
65
             value: item.value,
71
             value: item.value,
@@ -90,7 +96,7 @@ export default {
90
 <style lang="scss" scoped>
96
 <style lang="scss" scoped>
91
 .item-distribution {
97
 .item-distribution {
92
   .chart-container {
98
   .chart-container {
93
-    height: 300rpx;
99
+    height: 450rpx;
94
   }
100
   }
95
 
101
 
96
   .legend-grid {
102
   .legend-grid {

+ 26 - 10
src/pages/components/MemberBasicDistribution.vue

@@ -75,9 +75,14 @@ export default {
75
           trigger: 'item',
75
           trigger: 'item',
76
           formatter: '{b}: {c} ({d}%)'
76
           formatter: '{b}: {c} ({d}%)'
77
         },
77
         },
78
+        legend: {
79
+          data: this.chartsData.gender.labels,
80
+          textStyle: { color: '#666', fontSize: 10 },
81
+          top: 0
82
+        },
78
         series: [{
83
         series: [{
79
           type: 'pie',
84
           type: 'pie',
80
-          radius: ['40%', '60%'],
85
+          radius: ['25%', '40%'],
81
           data: this.chartsData.gender.data.map((value, index) => ({
86
           data: this.chartsData.gender.data.map((value, index) => ({
82
             name: this.chartsData.gender.labels[index],
87
             name: this.chartsData.gender.labels[index],
83
             value: value
88
             value: value
@@ -108,19 +113,25 @@ export default {
108
           trigger: 'item',
113
           trigger: 'item',
109
           formatter: '{b}: {c} ({d}%)'
114
           formatter: '{b}: {c} ({d}%)'
110
         },
115
         },
116
+        legend: {
117
+          type: 'scroll',
118
+          data: this.chartsData.ethnicity.labels,
119
+          textStyle: { color: '#666', fontSize: 10 },
120
+          top: 0
121
+        },
111
         series: [{
122
         series: [{
112
           type: 'pie',
123
           type: 'pie',
113
-          radius: ['40%', '60%'],
124
+          radius: ['25%', '40%'],
114
           data: this.chartsData.ethnicity.data.map((value, index) => ({
125
           data: this.chartsData.ethnicity.data.map((value, index) => ({
115
             name: this.chartsData.ethnicity.labels[index],
126
             name: this.chartsData.ethnicity.labels[index],
116
             value: value
127
             value: value
117
           })),
128
           })),
118
-          itemStyle: {
119
-            color: function(params) {
120
-              const colors = ['#A78BFA', '#34D399']
121
-              return colors[params.dataIndex]
122
-            }
123
-          },
129
+          // itemStyle: {
130
+          //   color: function(params) {
131
+          //     const colors = ['#A78BFA', '#34D399']
132
+          //     return colors[params.dataIndex]
133
+          //   }
134
+          // },
124
           label: {
135
           label: {
125
             show: true,
136
             show: true,
126
             color: '#333',
137
             color: '#333',
@@ -141,9 +152,14 @@ export default {
141
           trigger: 'item',
152
           trigger: 'item',
142
           formatter: '{b}: {c} ({d}%)'
153
           formatter: '{b}: {c} ({d}%)'
143
         },
154
         },
155
+        legend: {
156
+          data: this.chartsData.political.labels,
157
+          textStyle: { color: '#666', fontSize: 10 },
158
+          top: 0
159
+        },
144
         series: [{
160
         series: [{
145
           type: 'pie',
161
           type: 'pie',
146
-          radius: ['40%', '60%'],
162
+          radius: ['25%', '40%'],
147
           data: this.chartsData.political.data.map((value, index) => ({
163
           data: this.chartsData.political.data.map((value, index) => ({
148
             name: this.chartsData.political.labels[index],
164
             name: this.chartsData.political.labels[index],
149
             value: value
165
             value: value
@@ -195,7 +211,7 @@ export default {
195
 
211
 
196
     .chart-container {
212
     .chart-container {
197
       flex: 1;
213
       flex: 1;
198
-      height:250rpx;
214
+      height:450rpx;
199
     }
215
     }
200
   }
216
   }
201
 }
217
 }

+ 18 - 3
src/pages/components/MemberPositionDistribution.vue

@@ -73,11 +73,16 @@ export default {
73
           trigger: 'axis',
73
           trigger: 'axis',
74
           axisPointer: { type: 'shadow' }
74
           axisPointer: { type: 'shadow' }
75
         },
75
         },
76
+        legend: {
77
+          data: ['人数'],
78
+          textStyle: { color: '#666', fontSize: 10 },
79
+          top: 0
80
+        },
76
         grid: {
81
         grid: {
77
           left: '10%',
82
           left: '10%',
78
           right: '5%',
83
           right: '5%',
79
           bottom: '14%',
84
           bottom: '14%',
80
-          top: '10%'
85
+          top: '22%'
81
         },
86
         },
82
         xAxis: {
87
         xAxis: {
83
           type: 'category',
88
           type: 'category',
@@ -144,11 +149,16 @@ export default {
144
           trigger: 'axis',
149
           trigger: 'axis',
145
           axisPointer: { type: 'shadow' }
150
           axisPointer: { type: 'shadow' }
146
         },
151
         },
152
+        legend: {
153
+          data: ['人数'],
154
+          textStyle: { color: '#666', fontSize: 10 },
155
+          top: 0
156
+        },
147
         grid: {
157
         grid: {
148
           left: '10%',
158
           left: '10%',
149
           right: '5%',
159
           right: '5%',
150
           bottom: '14%',
160
           bottom: '14%',
151
-          top: '10%'
161
+          top: '22%'
152
         },
162
         },
153
         xAxis: {
163
         xAxis: {
154
           type: 'category',
164
           type: 'category',
@@ -215,11 +225,16 @@ export default {
215
           trigger: 'axis',
225
           trigger: 'axis',
216
           axisPointer: { type: 'shadow' }
226
           axisPointer: { type: 'shadow' }
217
         },
227
         },
228
+        legend: {
229
+          data: ['人数'],
230
+          textStyle: { color: '#666', fontSize: 10 },
231
+          top: 0
232
+        },
218
         grid: {
233
         grid: {
219
           left: '10%',
234
           left: '10%',
220
           right: '5%',
235
           right: '5%',
221
           bottom: '20%',
236
           bottom: '20%',
222
-          top: '10%'
237
+          top: '22%'
223
         },
238
         },
224
         xAxis: {
239
         xAxis: {
225
           type: 'category',
240
           type: 'category',

+ 21 - 3
src/pages/components/SecurityTestCharts.vue

@@ -83,9 +83,15 @@ export default {
83
           trigger: 'item',
83
           trigger: 'item',
84
           formatter: '{b}: {c} ({d}%)'
84
           formatter: '{b}: {c} ({d}%)'
85
         },
85
         },
86
+        legend: {
87
+          type: 'scroll',
88
+          data: this.chartsData.items.labels,
89
+          textStyle: { color: '#666', fontSize: 10 },
90
+          top: 0
91
+        },
86
         series: [{
92
         series: [{
87
           type: 'pie',
93
           type: 'pie',
88
-          radius: ['50%', '70%'],
94
+          radius: ['30%', '40%'],
89
           data: this.chartsData.items.labels.map((label, index) => ({
95
           data: this.chartsData.items.labels.map((label, index) => ({
90
             name: label,
96
             name: label,
91
             value: this.chartsData.items.data[index]
97
             value: this.chartsData.items.data[index]
@@ -112,13 +118,19 @@ export default {
112
       const option = {
118
       const option = {
113
         responsive: true,
119
         responsive: true,
114
         maintainAspectRatio: false,
120
         maintainAspectRatio: false,
121
+        legend: {
122
+          type: 'scroll',
123
+          data: this.chartsData.results.labels,
124
+          textStyle: { color: '#666', fontSize: 10 },
125
+          top: 0
126
+        },
115
         tooltip: {
127
         tooltip: {
116
           trigger: 'item',
128
           trigger: 'item',
117
           formatter: '{b}: {c} ({d}%)'
129
           formatter: '{b}: {c} ({d}%)'
118
         },
130
         },
119
         series: [{
131
         series: [{
120
           type: 'pie',
132
           type: 'pie',
121
-          radius: ['50%', '70%'],
133
+          radius: ['30%', '40%'],
122
           data: this.chartsData.results.labels.map((label, index) => ({
134
           data: this.chartsData.results.labels.map((label, index) => ({
123
             name: label,
135
             name: label,
124
             value: this.chartsData.results.data[index]
136
             value: this.chartsData.results.data[index]
@@ -149,9 +161,15 @@ export default {
149
           trigger: 'item',
161
           trigger: 'item',
150
           formatter: '{b}: {c} ({d}%)'
162
           formatter: '{b}: {c} ({d}%)'
151
         },
163
         },
164
+        legend: {
165
+          type: 'scroll',
166
+          data: this.chartsData.areas.labels,
167
+          textStyle: { color: '#666', fontSize: 10 },
168
+          top: 0
169
+        },
152
         series: [{
170
         series: [{
153
           type: 'pie',
171
           type: 'pie',
154
-          radius: ['50%', '70%'],
172
+          radius: ['30%', '40%'],
155
           data: this.chartsData.areas.labels.map((label, index) => ({
173
           data: this.chartsData.areas.labels.map((label, index) => ({
156
             name: label,
174
             name: label,
157
             value: this.chartsData.areas.data[index]
175
             value: this.chartsData.areas.data[index]

+ 6 - 1
src/pages/components/SeizedNumAll.vue

@@ -47,7 +47,12 @@ export default {
47
                     left: '15%',
47
                     left: '15%',
48
                     right: '5%',
48
                     right: '5%',
49
                     bottom: '15%',
49
                     bottom: '15%',
50
-                    top: '10%'
50
+                    top: '22%'
51
+                },
52
+                legend: {
53
+                    data: ['查获数'],
54
+                    textStyle: { color: '#666', fontSize: 10 },
55
+                    top: 0
51
                 },
56
                 },
52
                 xAxis: {
57
                 xAxis: {
53
                     type: 'category',
58
                     type: 'category',

+ 6 - 1
src/pages/components/SeizureInfo.vue

@@ -130,11 +130,16 @@ export default {
130
           trigger: 'axis',
130
           trigger: 'axis',
131
           axisPointer: { type: 'shadow' }
131
           axisPointer: { type: 'shadow' }
132
         },
132
         },
133
+        legend: {
134
+          data: ['查获数量'],
135
+          textStyle: { color: '#666', fontSize: 10 },
136
+          top: 0
137
+        },
133
         grid: {
138
         grid: {
134
           left: '15%',
139
           left: '15%',
135
           right: '5%',
140
           right: '5%',
136
           bottom: '15%',
141
           bottom: '15%',
137
-          top: '10%'
142
+          top: '22%'
138
         },
143
         },
139
         xAxis: {
144
         xAxis: {
140
           type: 'category',
145
           type: 'category',

+ 6 - 1
src/pages/components/SupervisionDistribution.vue

@@ -47,7 +47,7 @@ export default {
47
                     left: '15%',
47
                     left: '15%',
48
                     right: '5%',
48
                     right: '5%',
49
                     bottom: '20%',
49
                     bottom: '20%',
50
-                    top: '10%'
50
+                    top: '22%'
51
                 },
51
                 },
52
                 xAxis: {
52
                 xAxis: {
53
                     type: 'category',
53
                     type: 'category',
@@ -101,6 +101,11 @@ export default {
101
                         barWidth: '40%'
101
                         barWidth: '40%'
102
                     }
102
                     }
103
                 ],
103
                 ],
104
+                legend: {
105
+                    data: ['查获数量'],
106
+                    textStyle: { color: '#666', fontSize: 10 },
107
+                    top: 0
108
+                },
104
                 tooltip: {
109
                 tooltip: {
105
                     trigger: 'axis',
110
                     trigger: 'axis',
106
                     axisPointer: { type: 'shadow' }
111
                     axisPointer: { type: 'shadow' }

+ 6 - 1
src/pages/components/UnsafeItemsChart.vue

@@ -61,6 +61,11 @@ export default {
61
           trigger: 'item',
61
           trigger: 'item',
62
           formatter: '{b}: {c} ({d}%)'
62
           formatter: '{b}: {c} ({d}%)'
63
         },
63
         },
64
+        legend: {
65
+          data: this.chartsData.items.map(item => item.name),
66
+          textStyle: { color: '#666', fontSize: 10 },
67
+          top: 0
68
+        },
64
         series: [{
69
         series: [{
65
           type: 'pie',
70
           type: 'pie',
66
           radius: ['50%', '70%'],
71
           radius: ['50%', '70%'],
@@ -94,7 +99,7 @@ export default {
94
 <style lang="scss" scoped>
99
 <style lang="scss" scoped>
95
 .unsafe-items-chart {
100
 .unsafe-items-chart {
96
   .chart-container {
101
   .chart-container {
97
-    height: 220rpx;
102
+    height: 400rpx;
98
   }
103
   }
99
 
104
 
100
   .items-list {
105
   .items-list {

+ 7 - 2
src/pages/components/UnsafePositionChart.vue

@@ -56,11 +56,16 @@ export default {
56
           trigger: 'axis',
56
           trigger: 'axis',
57
           axisPointer: { type: 'shadow' }
57
           axisPointer: { type: 'shadow' }
58
         },
58
         },
59
+        legend: {
60
+          data: ['人数'],
61
+          textStyle: { color: '#666', fontSize: 10 },
62
+          top: 0
63
+        },
59
         grid: {
64
         grid: {
60
           left: '15%',
65
           left: '15%',
61
           right: '5%',
66
           right: '5%',
62
           bottom: '15%',
67
           bottom: '15%',
63
-          top: '10%'
68
+          top: '22%'
64
         },
69
         },
65
         xAxis: {
70
         xAxis: {
66
           type: 'category',
71
           type: 'category',
@@ -126,7 +131,7 @@ export default {
126
 <style lang="scss" scoped>
131
 <style lang="scss" scoped>
127
 .unsafe-position-chart {
132
 .unsafe-position-chart {
128
   .chart-container {
133
   .chart-container {
129
-    height: 240rpx;
134
+    height: 400rpx;
130
   }
135
   }
131
 
136
 
132
   .position-info {
137
   .position-info {

+ 6 - 1
src/pages/components/UnsafeTypesChart.vue

@@ -61,6 +61,11 @@ export default {
61
           trigger: 'item',
61
           trigger: 'item',
62
           formatter: '{b}: {c} ({d}%)'
62
           formatter: '{b}: {c} ({d}%)'
63
         },
63
         },
64
+        legend: {
65
+          data: this.chartsData.types.map(item => item.name),
66
+          textStyle: { color: '#666', fontSize: 10 },
67
+          top: 0
68
+        },
64
         series: [{
69
         series: [{
65
           type: 'pie',
70
           type: 'pie',
66
           radius: ['50%', '70%'],
71
           radius: ['50%', '70%'],
@@ -94,7 +99,7 @@ export default {
94
 <style lang="scss" scoped>
99
 <style lang="scss" scoped>
95
 .unsafe-types-chart {
100
 .unsafe-types-chart {
96
   .chart-container {
101
   .chart-container {
97
-    height: 220rpx;
102
+    height: 400rpx;
98
   }
103
   }
99
 
104
 
100
   .types-list {
105
   .types-list {

+ 1 - 1
src/pages/deptProfile/index.vue

@@ -59,7 +59,7 @@
59
             </SectionTitle>
59
             </SectionTitle>
60
 
60
 
61
             <view v-if="activeTab === 'profile'">
61
             <view v-if="activeTab === 'profile'">
62
-                <SectionTitle title="维得分一览">
62
+                <SectionTitle title="维得分一览">
63
                     <ProfileRadar :chartsData="radarData" />
63
                     <ProfileRadar :chartsData="radarData" />
64
                 </SectionTitle>
64
                 </SectionTitle>
65
 
65