Skip to content

Commit 9dd76d9

Browse files
graph selection update
* selection/zoom will no longer reset on new data * a selection that reaches the end, will get new data append as it arrives. Basically, allow monitoring the freshes data on large datasets
1 parent 2c084b7 commit 9dd76d9

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
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 83
2+
# version 86
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: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,12 +124,13 @@ $(plot_holder).bind("plothover", function (event, pos, item) {
124124

125125
// double click on the plot clears selection
126126
$(plot_holder).bind("dblclick", function () {
127+
if(plot_options.xaxis) delete plot_options.xaxis;
127128
plot = $.plot("#telemetry_graph .holder", plot.getData(), plot_options);
128129
});
129130

130131
// limit range after selection
131132
$(plot_holder).bind("plotselected", function (event, ranges) {
132-
plot = $.plot("#telemetry_graph .holder", plot.getData(), $.extend(true, {}, plot_options, {
133+
plot = $.plot("#telemetry_graph .holder", plot.getData(), $.extend(true, plot_options, {
133134
xaxis: {
134135
min: ranges.xaxis.from,
135136
max: ranges.xaxis.to

js/tracker.js

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -813,11 +813,11 @@ function graphAddLastPosition(idx) {
813813

814814
//insert gap when there are 2mins, or more, without telemetry
815815
if(vehicles[idx].graph_data.length) {
816-
var ts_last_idx = vehicles[idx].graph_data[0].data.length - 1;
817-
var ts_last = vehicles[idx].graph_data[0].data[ts_last_idx][0];
816+
var ts_last_idx = data[0].data.length - 1;
817+
var ts_last = data[0].data[ts_last_idx][0];
818818

819819
if(ts_last + 120000 < ts) {
820-
$.each(vehicles[idx].graph_data, function(k,v) { v.data.push([ts_last+1, null]); })
820+
$.each(data, function(k,v) { v.data.push([ts_last+1, null]); })
821821
}
822822
}
823823

@@ -857,6 +857,15 @@ function graphAddLastPosition(idx) {
857857
data[i].data.push([ts, parseFloat(v)]);
858858
if(parseFloat(v) < 0) delete vehicles[idx].graph_yaxes[i].min;
859859
});
860+
861+
// if a selection is made, that reaches the end, new data will be appended as it comes
862+
if(plot_options.xaxis && follow_vehicle == idx) {
863+
var prev_idx = data[0].data.length - 2;
864+
var prev_ts = data[0].data[prev_idx][0];
865+
866+
// update the selection upper limit to the latest timestamp
867+
if(prev_ts == plot_options.xaxis.max) plot_options.xaxis.max = ts;
868+
}
860869
}
861870

862871
function refresh() {

0 commit comments

Comments
 (0)