wgsl.vue
3.63 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
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
<template>
<div class="wgsl">
<div class="title">陕西省不动产信息接入</div>
<div class="map-box" ref="mapContainProvince" />
</div>
</template>
<script>
import echarts from "echarts";
export default {
data () {
return {
provinceName: "shanxi1",
mapName: "陕西",
listArr: [{
name: '西安市',
value: '6000'
},
{
name: '宝鸡市',
value: '8000'
},
{
name: '咸阳市',
value: '3000'
},
{
name: '铜川市',
value: '7000'
},
{
name: '渭南市',
value: '1000'
},
{
name: '延安市',
value: '2000'
},
{
name: '榆林市',
value: '600'
},
{
name: '汉中市',
value: '3000'
},
{
name: '安康市',
value: '1000'
},
{
name: '商洛市',
value: '1000'
}], //城市json
max: "9000", //最大value值
min: "500", // 最小value值
};
},
methods: {
drawProvinceMap (provinceName, mapName) {
this.provinceName = provinceName;
this.mapName = mapName;
require(`./map/${this.provinceName}.js`);
let _this = this;
let myChart8 = echarts.init(this.$refs.mapContainProvince);
const option = {
visualMap: {
min: _this.min,
max: _this.max,
show: false,
inRange: {
color: ["lightskyblue"],
},
},
tooltip: {
trigger: "item",
formatter: function (params) {
return params.value ? params.name + ':' + params.value + '件' : params.name + ':' + '0件'
},
borderColor: "#CB000C",
borderWidth: "1",
},
series: [
{
type: "map",
map: this.mapName,
itemStyle: {
// normal: { label: { show: true } },
normal: { //正常状态
label: {
show: true,
formatter: '{b}', //地图上显示的数据,分别对应data中的name和value
color: '#fff',
},
areaColor: '#409EFF' //地图区域的颜色
},
emphasis: {
label: { show: true },
areaColor: "#67C23A", //鼠标进入时的颜色
},
},
data: _this.listArr,
},
],
};
myChart8.setOption(option);
},
},
mounted () {
this.drawProvinceMap("shanxi1", "陕西");
}
}
</script>
<style scoped>
.wgsl {
width: 100%;
}
.title {
text-align: center;
line-height: 36px;
font-size: 26px;
}
.map-box {
display: inline-block;
width: 100%;
height: 80vh;
}
</style>