Browse Source

bug fixed

duwendi 1 year ago
parent
commit
c7451c5b63

+ 1 - 1
src/pages/index/components/business_overview.vue

@@ -6,7 +6,7 @@
6 6
         <piechart
7 7
           class="model-pie-body"
8 8
           id="chart1"
9
-          :radiusArr="['30%', '70%']"
9
+          :radiusArr="['30%', '50%']"
10 10
           :roseType = "false"
11 11
           :colorArr="modelPieColor"
12 12
           :labelFormat="['{name|{b}}', '{sub|{@value} {d}%}', '{hr|}']"

+ 3 - 3
src/pages/index/components/park_bahavior.vue

@@ -32,12 +32,12 @@
32 32
     </el-form>
33 33
     <br>
34 34
     <div class="charts" style="display: flex">
35
-      <div style="width: 50%;height: 300px;">
35
+      <div style="width: 50%;height: 320px;">
36 36
         <h5 style="color: white">停车时长分析</h5>
37 37
         <piechart
38 38
           class="model-pie-body"
39 39
           id="chart1"
40
-          :radiusArr="['30%', '70%']"
40
+          :radiusArr="['30%', '50%']"
41 41
           :roseType = "false"
42 42
           :colorArr="modelPieColor"
43 43
           :labelFormat="['{name|{b}}', '{sub|{@value}辆 {d}%}', '{hr|}']"
@@ -45,7 +45,7 @@
45 45
           :encode="{ itemName: 'name', value: 'value' }"
46 46
         />
47 47
       </div>
48
-      <div style="width: 50%;height: 300px;">
48
+      <div style="width: 50%;height: 320px;">
49 49
         <h5 style="color: white">停车时段分析</h5>
50 50
         <linechart
51 51
           :autoStop="false"

+ 171 - 58
src/pages/index/components/parking_area.vue

@@ -39,6 +39,7 @@
39 39
           :left="40"
40 40
           :legendTop="0"
41 41
           yAxisName="(%)"
42
+          :rotate="30"
42 43
           :dataset="linedata"
43 44
           :tooltipFormat="lineTooltipFormat1"
44 45
           :encode="[
@@ -50,8 +51,8 @@
50 51
     </div>
51 52
     <div style="display: flex; justify-content: space-between;margin-top: 5%">
52 53
       <div style="width: 100%; height: 500px;">
53
-        <div align="center" style="color: white">停车热度时空分布</div>
54
-        <div class="bottom" id="map"></div>
54
+        <div align="center" style="color: white;margin-bottom: 10px;">停车热度时空分布</div>
55
+        <div id="map" style="width: 100%; height: 600px;"/>
55 56
       </div>
56 57
     </div>
57 58
   </div>
@@ -59,11 +60,10 @@
59 60
 <script>
60 61
 import linechart from "@/components/lineChart";
61 62
 import barchart from "@/components/barChart";
62
-import * as echarts from 'echarts';
63
-import * as geoJson from '../../../util/411100.json';
64 63
 import api from '@/api/article_z'
65 64
 import options from '@/util/options'
66
-
65
+import * as echarts from 'echarts'
66
+import 'echarts-extension-amap'
67 67
 
68 68
 export default {
69 69
   components: {
@@ -77,47 +77,78 @@ export default {
77 77
       },
78 78
       districtOptions: options.districtOptions,
79 79
       option: {
80
-        backgroundColor: '#0c0c0c',
81
-        visualMap: {
82
-          bottom: 100,
83
-          left: 100,
84
-          min: 0,
85
-          max: 100,
86
-          color: ['#ff4601', '#fffc00', '#87cffa'],
87
-          calculable: true,
88
-          textStyle: {
89
-            color: '#fff',
90
-            fontSize: 12
91
-          },
92
-          seriesIndex: 0
80
+        amap: {
81
+          viewMode: '3D',
82
+          center: [114.02, 33.58],
83
+          zoom: 10,
84
+          resizeEnable: true,
85
+          //使用自定义主题
86
+          mapStyle: 'amap://styles/grey',
87
+          renderOnMoving: true,
88
+          largeMode: false
89
+
93 90
         },
94
-        geo: {
95
-          map: 'luohe',
96
-          show: true,
97
-          roam: false,
98
-          label: {
99
-            emphasis: {
91
+        tooltip: {
92
+          trigger: 'item'
93
+        },
94
+        animation: true,
95
+        series: [
96
+          {
97
+            name: 'PM2.5',
98
+            type: 'scatter',
99
+            coordinateSystem: 'amap',
100
+            data: [],
101
+            symbolSize: function (val) {
102
+              return val[2] / 10;
103
+            },
104
+            encode: {
105
+              value: 2
106
+            },
107
+            label: {
108
+              formatter: '{b}',
109
+              position: 'right',
100 110
               show: false
101
-            }
102
-          },
103
-          itemStyle: {
104
-            normal: {
105
-              areaColor: '#17439a',
106
-              borderColor: '#fff'
111
+            },
112
+            itemStyle: {
113
+              normal: {
114
+                color: '#00c1de'
115
+              }
107 116
             },
108 117
             emphasis: {
109
-              areaColor: '#17439a',
110
-              borderColor: '#fff'
118
+              label: {
119
+                show: true
120
+              }
111 121
             }
122
+          },
123
+          {
124
+            name: 'Top 5',
125
+            type: 'effectScatter',
126
+            coordinateSystem: 'amap',
127
+            data: [],
128
+            symbolSize: function (val) {
129
+              return val[2] / 10;
130
+            },
131
+            encode: {
132
+              value: 2
133
+            },
134
+            showEffectOn: 'render',
135
+            rippleEffect: {
136
+              brushType: 'stroke'
137
+            },
138
+            hoverAnimation: true,
139
+            label: {
140
+              formatter: '{b}',
141
+              position: 'right',
142
+              show: true
143
+            },
144
+            itemStyle: {
145
+              color: '#f00',
146
+              shadowBlur: 10,
147
+              shadowColor: '#333'
148
+            },
149
+            zlevel: 1
112 150
           }
113
-        },
114
-        series: [{
115
-          name: 'AQI',
116
-          type: 'heatmap',
117
-          coordinateSystem: 'geo',
118
-          blurSize: 40,
119
-          data: []
120
-        }]
151
+        ]
121 152
       },
122 153
       linedata: [],
123 154
       bardata: [],
@@ -125,6 +156,7 @@ export default {
125 156
   },
126 157
   mounted() {
127 158
     this.queryAll()
159
+
128 160
   },
129 161
   watch: {
130 162
 
@@ -167,23 +199,104 @@ export default {
167 199
       return `<div class="${type==='bar' ? 'bar-tooltip-dz' : type==='line' ? 'line-tooltip-dz' : ''}">${params[0].seriesName}:${data.hs || "--"}%</div>`;
168 200
     },
169 201
     getMapData() {
170
-      api.queryParkingArea_Tcrdskfb({...this.formInline}).then(res => {
171
-        let data = res.data || []
172
-        let areaData = [];
173
-        data.map(item => { //扩大热力图效果
174
-          areaData.push(...new Array(3).fill(item))
175
-        })
176
-        let mapMax = Math.max(...data.map(item => item[2]))
177
-        let mapMin = Math.min(...data.map(item => item[2]))
178
-        let chart = echarts.init(document.getElementById("map"));
179
-        echarts.registerMap("luohe", geoJson);
180
-
181
-        // echarts.registerMap('china', china)
182
-        this.option.series[0].data = areaData;
183
-        this.option.visualMap.min = mapMin;
184
-        this.option.visualMap.max = mapMax;
185
-        chart.setOption(this.option);
186
-      })
202
+      let myChart = echarts.init(document.getElementById("map"));
203
+      var data = [
204
+        { name: '车场A', value: 200 },
205
+        { name: '车场B', value: 100 },
206
+      ];
207
+      var geoCoordMap = {
208
+        '车场A': [113.97421800, 33.57179100],
209
+        '车场B': [114.03213800, 33.56496300],
210
+      };
211
+      var convertData = function (data) {
212
+        var res = [];
213
+        for (var i = 0; i < data.length; i++) {
214
+          var geoCoord = geoCoordMap[data[i].name];
215
+          if (geoCoord) {
216
+            res.push({
217
+              name: data[i].name,
218
+              value: geoCoord.concat(data[i].value)
219
+            });
220
+          }
221
+        }
222
+        return res;
223
+      };
224
+      let option = {
225
+        amap: {
226
+          viewMode: '3D',
227
+          center: [114.02, 33.58],
228
+          zoom: 10,
229
+          resizeEnable: true,
230
+          //使用自定义主题
231
+          mapStyle: 'amap://styles/grey',
232
+          renderOnMoving: true,
233
+          largeMode: false
234
+        },
235
+        tooltip: {
236
+          trigger: 'item'
237
+        },
238
+        animation: true,
239
+        series: [
240
+          {
241
+            name: 'PM2.5',
242
+            type: 'scatter',
243
+            coordinateSystem: 'amap',
244
+            data: convertData(data),
245
+            symbolSize: function (val) {
246
+              return val[2] / 10;
247
+            },
248
+            encode: {
249
+              value: 2
250
+            },
251
+            label: {
252
+              formatter: '{b}',
253
+              position: 'right',
254
+              show: false
255
+            },
256
+            itemStyle: {
257
+              normal: {
258
+                color: '#00c1de'
259
+              }
260
+            },
261
+            emphasis: {
262
+              label: {
263
+                show: true
264
+              }
265
+            }
266
+          },
267
+          {
268
+            name: 'Top 5',
269
+            type: 'effectScatter',
270
+            coordinateSystem: 'amap',
271
+            data: convertData(data.sort(function (a, b) {
272
+              return b.value - a.value;
273
+            }).slice(0, 6)),
274
+            symbolSize: function (val) {
275
+              return val[2] / 10;
276
+            },
277
+            encode: {
278
+              value: 2
279
+            },
280
+            showEffectOn: 'render',
281
+            rippleEffect: {
282
+              brushType: 'stroke'
283
+            },
284
+            hoverAnimation: true,
285
+            label: {
286
+              formatter: '{b}',
287
+              position: 'right',
288
+              show: false
289
+            },
290
+            itemStyle: {
291
+              color: '#f00',
292
+              shadowBlur: 10,
293
+              shadowColor: '#333'
294
+            },
295
+            zlevel: 1
296
+          }
297
+        ]
298
+      };
299
+      myChart.setOption(option);
187 300
     }
188 301
   }
189 302
 }
@@ -199,7 +312,7 @@ export default {
199 312
 </style>
200 313
 <style lang="less" scoped>
201 314
   .bottom {
202
-    height: 100%;
315
+    height: 600px;
203 316
     width: 100%;
204 317
   }
205 318
   /deep/ .el-input__inner {

+ 3 - 1
src/pages/index/index.html

@@ -5,7 +5,9 @@
5 5
     <meta name="viewport" content="width=device-width,initial-scale=1.0">
6 6
     <title>监管平台管理</title>
7 7
     <script src="static/mung-local-config.js"></script>
8
-    <script src="static/jquery-3.1.0.min.js"></script>
8
+    <script src="static/jquery-3.1.0.min.js"></script>   <!-- 在index.html中添加 -->
9
+    <script src="https://webapi.amap.com/maps?v=2.0&key=f1a27c94cbb2e9163a60a67b113245da"></script>
10
+
9 11
   </head>
10 12
   <body>
11 13
     <div id="index"></div>