Skip to content

Commit 9b5b440

Browse files
pred.alt. is now aligned with altitude on graph
1 parent 6a400f9 commit 9b5b440

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

js/tracker.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,7 +1787,7 @@ function addPosition(position) {
17871787
};
17881788

17891789
// deep copy yaxes config for graph
1790-
$.each($.extend(plot_options.yaxes, {}), function(k,v) { vehicle_info.graph_yaxes.push(v); });
1790+
plot_options.yaxes.forEach(function(v) { vehicle_info.graph_yaxes.push($.extend({}, v)); });
17911791

17921792
// nyan mod
17931793
if(wvar.nyan && vehicle_info.vehicle_type == "balloon") {
@@ -2098,6 +2098,7 @@ function graphAddPosition(vcallsign, new_data) {
20982098
data: []
20992099
};
21002100

2101+
vehicle.graph_yaxes[i].max = 0;
21012102
i += 1;
21022103

21032104
data[i] = {
@@ -2109,9 +2110,19 @@ function graphAddPosition(vcallsign, new_data) {
21092110
data: []
21102111
};
21112112

2113+
vehicle.graph_yaxes[i].max = 0;
21122114
}
21132115

2114-
if(parseInt(new_data.gps_alt) < 0) delete vehicle.graph_yaxes[i].min;
2116+
// set yrange for altitude and pred.alt, so they are aligned
2117+
if(parseInt(new_data.gps_alt) < vehicle.graph_yaxes[0].min) {
2118+
vehicle.graph_yaxes[0].min = parseInt(new_data.gps_alt);
2119+
vehicle.graph_yaxes[1].min = vehicle.graph_yaxes[0].min;
2120+
}
2121+
2122+
if(parseInt(new_data.gps_alt) > vehicle.graph_yaxes[0].max) {
2123+
vehicle.graph_yaxes[0].max = parseInt(new_data.gps_alt);
2124+
vehicle.graph_yaxes[1].max = vehicle.graph_yaxes[0].max;
2125+
}
21152126

21162127
// we don't record extra data, if there is no telemetry graph loaded
21172128
// altitude is used for altitude profile

0 commit comments

Comments
 (0)