Skip to content

Commit 8524954

Browse files
graph interpolates float data; int data as steps
1 parent 4a6abcf commit 8524954

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
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 51
2+
# version 52
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: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -79,20 +79,22 @@ function updateLegend() {
7979
}
8080
}
8181

82-
// Now Interpolate
82+
var y;
83+
if(series.noInterpolate > 0) { y = series.data[j - 1][1]; }
84+
else {
85+
var p1 = series.data[j - 1],
86+
p2 = series.data[j];
8387

84-
var y,
85-
p1 = series.data[j - 1],
86-
p2 = series.data[j];
87-
88-
if (p1 == null) {
89-
y = p2[1];
90-
} else if (p2 == null) {
91-
y = p1[1];
92-
} else {
93-
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
88+
if (p1 == null) {
89+
y = p2[1];
90+
} else if (p2 == null) {
91+
y = p1[1];
92+
} else {
93+
y = p1[1] + (p2[1] - p1[1]) * (pos.x - p1[0]) / (p2[0] - p1[0]);
94+
}
95+
y = y.toFixed(2);
9496
}
95-
legend.eq(i).text(series.label.replace(/=.*/, "= " + y.toFixed(2)));
97+
legend.eq(i).text(series.label.replace(/=.*/, "= " + y));
9698
}
9799
}
98100

js/tracker.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -795,8 +795,6 @@ function graphAddLastPosition(idx) {
795795
if(data[0] === undefined) {
796796
data[0] = {
797797
label: "altitude = 0",
798-
hoverable: true,
799-
clickable: true,
800798
color: '#33B5E5',
801799
yaxis: 1,
802800
lines: { show:true, fill: true, fillColor: "rgba(51, 181, 229, 0.1)" },
@@ -817,11 +815,11 @@ function graphAddLastPosition(idx) {
817815
if(data[i] === undefined) {
818816
data[i] = {
819817
label: k + " = 0",
820-
hoverable: true,
821-
clickable: true,
822818
yaxis: i + 1,
823819
data: []
824820
};
821+
822+
if(isInt(v)) $.extend(true, data[i], { noInterpolate: true, lines: { steps: true }});
825823
}
826824
data[i].data.push([ts, parseFloat(v)]);
827825
});
@@ -1097,3 +1095,7 @@ function update(response) {
10971095

10981096
if(listScroll) listScroll.refresh();
10991097
}
1098+
1099+
function isInt(n) {
1100+
return n % 1 === 0;
1101+
}

0 commit comments

Comments
 (0)