-
Notifications
You must be signed in to change notification settings - Fork 0
/
map.html
185 lines (170 loc) · 3.8 KB
/
map.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
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>EOSIO Scholar Testnet</title>
<script src="src/js/echarts.min.js"></script>
<script src="src/js/bmap.min.js"></script>
<script src="src/js/world.js"></script>
<script src="producer.js"></script>
</head>
<link rel="stylesheet" href="src/style/map.css?20180416"/>
<body>
<div id="main"></div>
<div class="bottom">
<div class="sponsor">
Created by <a target="_blank" href="https://meet.one/en">MEET.ONE</a>
Sponsored/collaboration with:
<a target="_blank" href="https://eosnation.io/">EOS Nation</a>
<a target="_blank" href="https://www.eosocal.io/">EOSoCal</a>
<a target="_blank" href="https://eoscannon.io">EOS Cannon</a>
</div>
<a target="_blank" class="educational-material" href="https://github.com/ScholarTestnet">
Educational material
</a>
</div>
<script type="text/javascript">
var myChart = echarts.init(document.getElementById('main'));
var data = producerList;
var convertData = function (data, from) {
var res = [];
for (var i = 0; i < data.length; i++) {
var dataItem = data[i];
var fromCoord = data[from].LngLat;
var toCoord = data[i].LngLat;
if (fromCoord && toCoord) {
res.push([{
coord: fromCoord
}, {
coord: toCoord,
value: dataItem.LngLat
}]);
}
}
return res;
};
function getScatterStyle(isActive, data) {
return {
type: 'effectScatter',
coordinateSystem: 'geo',
zlevel: 2,
rippleEffect: {
period: 4,
scale: 4,
brushType: isActive ? 'stroke' : 'none'
},
symbolSize: 8,
label: {
normal: {
show: true,
position: 'right',
offset: [5, 0],
formatter: '{b}',
textStyle: {
fontSize: 20
}
}
},
itemStyle: {
normal: {
color: isActive ? '#3E00FF' : '#008BFF'
},
emphasis: {
color: isActive ? 'lime' : '#7ED321'
}
},
data: data.map(function (item) {
item.name = isActive ? item.organization_name : '';
return item;
})
}
}
function getInitSeries() {
var defaultProducer = [];
var activeProducer = [];
for (var i = 0, len = data.length; i < len; i++) {
var tNam = data[i].organization_name;
if (i !== currentIndex) {
defaultProducer.push({
organization_name: tNam,
value: data[i].LngLat
});
} else {
activeProducer.push({
organization_name: tNam,
value: data[i].LngLat
});
}
}
return [getScatterStyle(false, defaultProducer), getScatterStyle(true, activeProducer)];
}
var series = getInitSeries();
var option = {
backgroundColor: '#f2f2f2',
title: {
text: 'Scholar Testnet',
left: 'center',
textStyle: {
color: '#443F54'
}
},
geo: {
type: 'map',
map: 'world',
roam: true,
itemStyle: {
normal: {
color: '#ffffff',
borderColor: '#cccccc'
},
emphasis: {
color: '#fafafa'
}
}
},
tooltip: {
trigger: 'item',
formatter: function (param) {
return param.data.organization_name;
}
},
series: series
};
myChart.setOption(option);
var currentIndex = 0;
function render() {
series = getInitSeries();
series.push({
type: 'lines',
zlevel: 2,
effect: {
show: true,
period: 2,
trailLength: 0.01,
symbol: 'arrow',
symbolSize: 5
},
lineStyle: {
normal: {
color: '#9BBDF7',
width: 1
}
},
data: convertData(data, currentIndex)
});
console.log(data[currentIndex].organization_name);
if (currentIndex < data.length - 1) {
currentIndex++;
} else {
currentIndex = 0;
}
option.series = series;
myChart.setOption(option);
setTimeout(function () {
render();
}, 6000);
}
render();
</script>
</body>
</html>