Skip to content

Commit 75e6ec5

Browse files
committed
#1 EOD commit.
1 parent 566ba8b commit 75e6ec5

File tree

5 files changed

+194
-127
lines changed

5 files changed

+194
-127
lines changed

public/css/default.css

+21-1
Original file line numberDiff line numberDiff line change
@@ -552,14 +552,34 @@ pre.ui-coordinates {
552552
.axis {
553553
font: 10px sans-serif;
554554
}
555+
555556
.axis path,
556557
.axis line {
557558
fill: none;
558559
stroke: #000;
559560
shape-rendering: crispEdges;
560561
}
562+
561563
.brush .extent {
562564
stroke: #fff;
563-
fill-opacity: .125;
565+
fill-opacity: .225;
564566
shape-rendering: crispEdges;
567+
}
568+
569+
svg.timeline {
570+
571+
background-color:whitesmoke;
572+
573+
position: absolute;
574+
top: 10px;
575+
width: 660px;
576+
left: 50%;
577+
margin-left: -330px;
578+
border:1px solid white;
579+
padding:2px;
580+
}
581+
582+
.bar {
583+
fill: black;
584+
fill-opacity:0.825;
565585
}

public/js/joola.js

+100-64
Original file line numberDiff line numberDiff line change
@@ -1,78 +1,113 @@
1+
var query = {
2+
timeframe: 'last_5_seconds',
3+
interval: 'second',
4+
dimensions: ['location.lat', 'location.lon', 'tag'],
5+
metrics: ['metric'],
6+
collection: 'geo',
7+
realtime: {
8+
enabled: true,
9+
interval: state.get('config.refresh.duration')
10+
}
11+
};
12+
var lastQueryUUID = '';
113
joola.on('ready', function () {
214
console.log('Joola SDK ready, version', joola.VERSION);
3-
var query = {
4-
timeframe: 'last_5_seconds',
5-
interval: 'second',
6-
dimensions: ['location.lat', 'location.lon', 'tag'],
7-
metrics: ['metric'],
8-
collection: 'geo',
9-
realtime: {
10-
enabled: false,
11-
interval: state.get('config.refresh.duration')
15+
16+
joola.on('query_updated', function () {
17+
if (lastQueryUUID && lastQueryUUID.length > 0){
18+
console.log('stopping',lastQueryUUID);
19+
joola.query.stop(lastQueryUUID);
1220
}
13-
};
14-
/*new joola.viz.Table({
15-
container: '#table',
16-
query: query,
17-
pickers: {
18-
primary: {
19-
enabled: false
20-
},
21-
add_dimension: {
22-
enabled: true,
23-
caption: 'Add dimension...',
24-
allowRemove: false,
25-
allowSelect: false
26-
},
27-
add_metric: {
28-
enabled: true,
29-
caption: 'Add metric...',
30-
allowRemove: false,
31-
allowSelect: false
32-
}
33-
},
34-
enter: function (data) {
35-
var addMarker = function (point) {
36-
var marker = new google.maps.Marker({
37-
position: new google.maps.LatLng(point.lat, point.lon),
38-
map: map
39-
});
40-
var chHtml = "<h4>Event details</h4><div>";
41-
Object.keys(point).forEach(function (key) {
42-
var elem = point[key];
43-
if (typeof elem !== 'object')
44-
chHtml += '<strong>' + key + ':</strong> ' + elem + '<br/>';
45-
});
46-
var chInfoWindow = new google.maps.InfoWindow({
47-
content: chHtml,
48-
maxWidth: 250
49-
});
50-
google.maps.event.addListener(marker, 'click', function () {
51-
chInfoWindow.open(map, marker);
52-
});
53-
setTimeout(function () {
54-
marker.setMap(null);
55-
}, state.get('config.tail.duration'));
56-
};
21+
22+
joola.query.fetch(query, function (err, docs) {
23+
if (err)
24+
throw err;
25+
26+
lastQueryUUID = docs[0].query.realtimeUID;
5727

28+
var data = docs[0].documents;
5829
data.forEach(function (point) {
59-
point = point.raw;
6030
point.lat = point.location_lat;
6131
point.lon = point.location_lon;
62-
//addMarker(point);
6332

64-
var marker = L.marker([point.lat, point.lon], {
65-
icon: L.mapbox.marker.icon({
66-
'marker-color': '#f86767'
67-
})
33+
var marker = L.marker(new L.LatLng(point.lat, point.lon), {
34+
icon: L.mapbox.marker.icon({'marker-color': '#f86767', 'marker-size': 'small'}),
35+
data: point
6836
});
69-
//marker.addTo(map);
37+
markers.addLayer(marker);
38+
});
39+
markers.eachLayer(function (marker) {
40+
//heat.addLatLng(marker.getLatLng());
7041

7142
});
72-
// L.mapbox.featureLayer(geojson).addTo(map);
73-
}
43+
});
7444
});
75-
*/
45+
setTimeout(function () {
46+
joola.emit('query_updated');
47+
}, 500);
48+
49+
/*new joola.viz.Table({
50+
container: '#table',
51+
query: query,
52+
pickers: {
53+
primary: {
54+
enabled: false
55+
},
56+
add_dimension: {
57+
enabled: true,
58+
caption: 'Add dimension...',
59+
allowRemove: false,
60+
allowSelect: false
61+
},
62+
add_metric: {
63+
enabled: true,
64+
caption: 'Add metric...',
65+
allowRemove: false,
66+
allowSelect: false
67+
}
68+
},
69+
enter: function (data) {
70+
var addMarker = function (point) {
71+
var marker = new google.maps.Marker({
72+
position: new google.maps.LatLng(point.lat, point.lon),
73+
map: map
74+
});
75+
var chHtml = "<h4>Event details</h4><div>";
76+
Object.keys(point).forEach(function (key) {
77+
var elem = point[key];
78+
if (typeof elem !== 'object')
79+
chHtml += '<strong>' + key + ':</strong> ' + elem + '<br/>';
80+
});
81+
var chInfoWindow = new google.maps.InfoWindow({
82+
content: chHtml,
83+
maxWidth: 250
84+
});
85+
google.maps.event.addListener(marker, 'click', function () {
86+
chInfoWindow.open(map, marker);
87+
});
88+
setTimeout(function () {
89+
marker.setMap(null);
90+
}, state.get('config.tail.duration'));
91+
};
92+
93+
data.forEach(function (point) {
94+
point = point.raw;
95+
point.lat = point.location_lat;
96+
point.lon = point.location_lon;
97+
//addMarker(point);
98+
99+
var marker = L.marker([point.lat, point.lon], {
100+
icon: L.mapbox.marker.icon({
101+
'marker-color': '#f86767'
102+
})
103+
});
104+
//marker.addTo(map);
105+
106+
});
107+
// L.mapbox.featureLayer(geojson).addTo(map);
108+
}
109+
});
110+
*/
76111
/*
77112
joola.on('polygon_added', function (marker) {
78113
var _query = joola.common.extend(query, {
@@ -121,7 +156,8 @@ joola.on('ready', function () {
121156
joola.io.socket.on('event', function (collection, data) {
122157
if (['geo'].indexOf(collection) === -1)
123158
return;
124-
EPSData.push(data.length);
159+
EPSData.shift();
160+
EPSData.push({timestamp: new Date(), metric: 0, total: data.length});
125161
data.forEach(function (point) {
126162
point.lat = point.location.lat;
127163
point.lon = point.location.lon;

public/js/leaflet.js

+3
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,9 @@ $().ready(function () {
7878
heat.addLatLng(l.getLatLng());
7979
});
8080
});*/
81+
82+
joola.emit('start');
83+
8184
});
8285

8386

0 commit comments

Comments
 (0)