地图2D
<template>
<div ref="henan_map" style="width: 100%; height: 83vh" />
</template>
<script>
export default {
data() {
return {
henanJson: require('/docs/.vuepress/utils/河南省.json'),
};
},
mounted() {
this.initChart();
},
methods: {
initChart() {
const chart = echarts.init(this.$refs.henan_map);
echarts.registerMap('henan', this.henanJson);
let option = {
tooltip: {
trigger: 'item',
},
legend: {
orient: 'horizontal',
left: 'right',
top: 'top',
},
geo: {
map: 'henan',
emphasis: {
label: {
show: true,
textStyle: {
show: true,
fontWeight: 'bold',
fontSize: 18,
color: 'red',
},
},
itemStyle: {
areaColor: 'rgba(246,227,17,0.1)',
borderColor: '#CCC',
},
},
label: {
show: true,
textStyle: {
color: '#000',
fontWeight: 'bold',
fontSize: 18,
},
},
itemStyle: {
areaColor: 'rgba(235,245,255,0.5)',
borderColor: '#CCC',
},
},
series: [],
};
chart.setOption(option, true);
},
},
};
</script>
<style lang="scss" scoped></style>
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
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
显示代码 复制代码 复制代码