Skip to content

Commit 7e9c787

Browse files
proper yaxes min range for each payload
1 parent 8c4d791 commit 7e9c787

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-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 58
2+
# version 59
33

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

js/tracker.js

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -713,11 +713,17 @@ function addPosition(position) {
713713
alt_list: [0],
714714
time_last_alt: 0,
715715
alt_max: 100,
716-
graph_data: []
716+
graph_data: [],
717+
graph_yaxes: []
717718
};
719+
720+
// deep copy yaxes config for graph
721+
$.each($.extend(false, plot_options.yaxes, {}), function(k,v) { vehicle_info.graph_yaxes.push(v) });
722+
718723
vehicles.push(vehicle_info);
719724
}
720725

726+
721727
var vehicle_index = $.inArray(position.vehicle, vehicle_names);
722728
var vehicle = vehicles[vehicle_index];
723729

@@ -785,7 +791,8 @@ function addPosition(position) {
785791
function updateGraph(idx) {
786792
if(!plot) return;
787793

788-
plot = $.plot(plot_holder, vehicles[idx].graph_data, plot_options);
794+
// replot graph, with this vehicle data, and this vehicles yaxes config
795+
plot = $.plot(plot_holder, vehicles[idx].graph_data, $.extend(false, plot_options, {yaxes:vehicles[idx].graph_yaxes}));
789796
}
790797

791798
function graphAddLastPosition(idx) {
@@ -809,7 +816,7 @@ function graphAddLastPosition(idx) {
809816

810817
// push latest altitude
811818
data[0].data.push([ts, parseInt(new_data.gps_alt)]);
812-
if(parseInt(new_data.gps_alt) < 0) delete plot_options.yaxes[series_idx-1].min;
819+
if(parseInt(new_data.gps_alt) < 0) delete vehicles[idx].graph_yaxes[series_idx-1].min;
813820

814821
// the rest of the series is from the data field
815822
var json = $.parseJSON(new_data.data);
@@ -830,7 +837,7 @@ function graphAddLastPosition(idx) {
830837
if(isInt(v)) $.extend(true, data[i], { noInterpolate: true, lines: { steps: true }});
831838
}
832839
data[i].data.push([ts, parseFloat(v)]);
833-
if(parseFloat(v) < 0) delete plot_options.yaxes[i+1].min;
840+
if(parseFloat(v) < 0) delete vehicles[idx].graph_yaxes[i].min;
834841
});
835842
}
836843

0 commit comments

Comments
 (0)