-
Notifications
You must be signed in to change notification settings - Fork 31
/
yga.html
82 lines (79 loc) · 1.84 KB
/
yga.html
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<div id="main" style="width: 800px;height: 600px"></div>
<script type="text/javascript" src="js/echarts.min.js"></script>
<script type="text/javascript" src="js/jquery-1.12.4.min.js"></script>
<script>
$.get('allMap/json/yga.json', function (geoJson) {
console.log(geoJson)
echarts.registerMap('广东', geoJson);
// 可从这里提取每个城市对应的json
var option_map = {
tooltip: {
trigger: 'item',
formatter: function (params) {
if (params.name) {
var value = params.value || 0;
return typeof value !== 'object' ? params.name + '<br>' + "提示 : " + value : params.name;
}
}
},
visualMap: {
type: 'continuous',
show: false,
min: 0,
max: 500,
left: 'left',
top: 'bottom',
text: ['高', '低'],
calculable: true,
// seriesIndex: [1],
inRange: {
//color: ['#dcc5fe', '#b592e9', '#a286ce', '#997dc2', '#7250a6']
color: ['#FFFFFF', '#0099FF']
}
},
geo: {
map: '广东',
roam: false
},
series: [{
type: 'map',
mapType: '广东',
roam: false,
label: {
normal: {
show: true,
position: 'inside',
textStyle: {
color: '#000000'
}
},
emphasis: {
show: true
}
},
itemStyle: {
normal: {
borderColor: 'transparent',
}
},
data: []
}]
};
var myChart = echarts.init(document.getElementById('main'));
//使用制定的配置项和数据显示图表
myChart.setOption(option_map);
myChart.on('click', function (params) {
// 通过点击事件下钻到下级
console.log(params)
})
});
</script>
</body>
</html>