-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathchart.html
More file actions
42 lines (40 loc) · 1.25 KB
/
Copy pathchart.html
File metadata and controls
42 lines (40 loc) · 1.25 KB
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
<!DOCTYPE html>
<html>
<head>
<script async defer
src="https://maps.googleapis.com/maps/api/js?key=${MAP_API_KEY}&callback=initMap">
</script>
</head>
<body>
<div id="map" style="width: 100%; height: 600px; background: grey"></div>
<div onclick="location.reload()">Click ME to refresh :-)</div>
<script type="text/javascript" charset="UTF-8" >
var data = ${data};
var center = {lat:${lat}, lng:${lon}};
var map = null;
var marker_path = "M 0 0 L -3 -10 -3 -15 3 -15 3 -10 z";
var click_handler = function(e) {
window.open("/pilot/"+this.label);
}
function initMap() {
map = new google.maps.Map( document.getElementById('map'), {zoom: 10, center: center});
for (var i = 0; i<data.length; i++) {
var p = {lat:data[i].lat, lng:data[i].lon};
var marker = new google.maps.Marker({
label: data[i].id,
position: p, map: map,
icon: { path: marker_path,
strokeColor: 'black',
strokeWeight: 1,
fillColor: data[i].color,
fillOpacity: 1.0,
scale: 5,
rotation: 0,
labelOrigin: {x:0, y:-12}
} } );
marker.addListener('click', click_handler );
}
}
</script>
</body>
</html>