Skip to content

Commit d4eecc9

Browse files
hovering over the graph, will place a marker over the path
1 parent 83383a1 commit d4eecc9

File tree

3 files changed

+18
-1
lines changed

3 files changed

+18
-1
lines changed

cache.manifest

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
CACHE MANIFEST
2-
# version 76
2+
# version 82
33

44
# gogole maps files
55
http://maps.google.com/maps/api/js?v=3.10&sensor=false&key=AIzaSyCOqkcNey4CCyG4X0X5qxHAhCgD8g5DwXg

js/plot_config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ var plot_options = {
4444
plot = $.plot(plot_holder, {}, plot_options);
4545
var updateLegendTimeout = null;
4646
var latestPosition = null;
47+
var polyMarker = null;
4748

4849
// updates legend with extrapolated values under the mouse position
4950
function updateLegend() {
@@ -95,6 +96,20 @@ function updateLegend() {
9596
}
9697
legend.eq(i).text(series.label.replace(/=.*/, "= " + y));
9798
}
99+
100+
if(!polyMarker) {
101+
polyMarker = new google.maps.Marker({
102+
clickable: false,
103+
flat: true,
104+
map: map,
105+
visible: true,
106+
icon: null
107+
});
108+
}
109+
110+
if(follow_vehicle != -1 && vehicles[follow_vehicle].positions.length) {
111+
polyMarker.setPosition(vehicles[follow_vehicle].positions[j]);
112+
}
98113
}
99114

100115
// update legend values on mouse hover

js/tracker.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -796,6 +796,8 @@ function addPosition(position) {
796796
function updateGraph(idx) {
797797
if(!plot) return;
798798

799+
if(polyMarker) polyMarker.setPosition(null);
800+
799801
// replot graph, with this vehicle data, and this vehicles yaxes config
800802
plot = $.plot(plot_holder, vehicles[idx].graph_data, $.extend(false, plot_options, {yaxes:vehicles[idx].graph_yaxes}));
801803
}

0 commit comments

Comments
 (0)