-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
98 lines (93 loc) · 3.01 KB
/
index.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
<!DOCTYPE html>
<html style="height: 100%">
<head>
<meta charset="utf-8" />
<title>地图</title>
<!-- 引入 echarts.js -->
<script src="js/jquery.min.js"></script>
<script type="text/javascript">
window.HOST_TYPE = 1;
</script>
<script src="js/echarts.min.js"></script>
<script src="js/bmap.js"></script>
<script src="https://api.map.baidu.com/getscript?v=3.0&ak=KOmVjPVUAey1G2E8zNhPiuQ6QiEmAwZu&services=amp&t=20200327103013"></script>
</head>
<body style="height: 100%; margin: 0">
<!-- 为ECharts准备一个具备大小(宽高)的Dom -->
<!-- 创建另外的图表, 可以有多个div, id='main1', 再使用mycharts.on('click') -->
<!-- 百度地图api使用的是公共example上的ak-->
<div id="main" style="height: 100%"></div>
<script type="text/javascript">
// 基于准备好的dom,初始化echarts实例
var myChart = echarts.init(document.getElementById("main"));
// 指定图表的配置项和数据
$.getJSON("data/data.json", function (data) {
$.getJSON("styleJson.json", function (styleJson) {
var options = [];
var day = [];
for (var i = 0; i < data.length; i++) {
day.push(i + 1);
// console.log(data.length);
options.push({
title: { text: data[i][0]["date"] + "居住地分布" },
series: [
{
type: "effectScatter",
data: data[i],
// name: data[i]["name"],
coordinateSystem: "bmap",
tooltip: {
formatter: function (params) {
return params["name"];
},
},
showEffectOn: "render",
rippleEffect: {
brushType: "stroke",
},
itemStyle: {
shadowBlur: 10,
shadowColor: "#333",
},
},
],
});
}
var option = {
timeline: {
data: day,
orient: "vertical",
left: "90%",
top: "5%",
height: "80%",
width: "8%",
axisType: "category",
autoPlay: true,
playInterval: 1500,
//rewind: true,
currentIndex: 0,
inverse: true,
},
bmap: {
center: [121.496838, 31.248963],
zoom: 11,
roam: true,
mapStyle: {
styleJson: styleJson,
},
},
title: {
text: "地图",
},
tooltip: {},
legend: {},
series: [{}],
options: options,
};
// 使用刚指定的配置项和数据显示图表。
myChart.setOption(option, true);
});
});
</script>
</body>
</html>