-
Notifications
You must be signed in to change notification settings - Fork 2
/
echartsDemo.html
75 lines (61 loc) · 1.89 KB
/
echartsDemo.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
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="initial-scale=1.0, user-scalable=no, width=device-width">
<title>下属行政区查询</title>
<link rel="stylesheet" href="https://a.amap.com/jsapi_demos/static/demo-center/css/demo-center.css"/>
<style type="text/css">
#container, #content{
/*height:100%;*/
width: 600px;
height: 400px;
display: inline-block;
border: 1px solid #cccccc;
}
</style>
</head>
<body>
<div id="container"></div>
</div>
<div>
<button id="cityHot">地级市</button>
<button id="districtHot">区县</button>
</div>
<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript" src="https://webapi.amap.com/maps?v=1.4.13&key=59ba5e8427f215f33f359b196119a1e2&plugin=AMap.DistrictSearch"></script>
<script src="amapHot.js"></script>
<script type="text/javascript">
var amapHot =$('#container').amapHot();
$('#cityHot').on('click', () => {
var data = amapHot.returnCityAdcode();
var adcodeCityObj = [];
for (var i = 0; i < data.length; i++) {
var num = Math.random() * 500;
adcodeCityObj.push({
adcode: data[i],
num: num,
});
}
amapHot.districtSearch(adcodeCityObj, 'city');
var s = amapHot.searchDistrictAdcode(232700);
console.log(s);
});
$('#districtHot').on('click', () => {
var data = amapHot.returnDistrictAdcode();
console.log(data);
var adcodeDistrictObj = [];
for (var i = 0; i < data.length; i++) {
var num = Math.random() * 500;
adcodeDistrictObj.push({
adcode: data[i],
num: num,
});
}
amapHot.districtSearch(adcodeDistrictObj, 'district');
})
</script>
<script type="text/javascript" src="https://webapi.amap.com/demos/js/liteToolbar.js"></script>
</body>
</html>