-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgetdata1.js
46 lines (34 loc) · 1.09 KB
/
getdata1.js
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
/* Function to get heatmap data from GA server. */
function connect(tsstart, tsend, event) {
var xmlHttp = null;
//All heatmap data for different events
if (!tsstart && !tsend) {
if (event == 'spray')
var url = "http://vm0063.virtues.fi/heatmaps/eventid/spray:blue%7Cspray:green%7Cspray:purple/time/a/"
else if (event == 'policebust')
var url = "http://vm0063.virtues.fi/heatmaps/eventid/policebust:blue%7Cpolicebust:green%7Cpolicebust:purple/time/a/"
}
xmlHttp = new XMLHttpRequest();
xmlHttp.onreadystatechange = function() {
if (xmlHttp.readyState == 4) {
console.log(xmlHttp.responseText);
}
}
xmlHttp.open ("GET", url, false);
xmlHttp.send(null);
}
/* How to get heatmap data, pretty straghtforward by naming. */
function getLastWeek() {
}
function getLastMonth() {
}
/* Get all data on heatmap - from spray */
function getAllSpray() {
connect(null, null, 'spray');
}
function getYesterday() {
var d = new Date();
d.setDate(d.getDate() - 1);
console.log(d.getTime() + "--" + new Date().getTime());
connect(d.getTime(), new Date().getTime());
}