Commit 3366afd7 authored by Michael Ochmann's avatar Michael Ochmann
Browse files

added values to graph

parent 6cc6d327
......@@ -27,18 +27,18 @@ class HeightMapViewController extends UIViewController {
}
capture() {
navigator.geolocation.getCurrentPosition(position => {
/* navigator.geolocation.getCurrentPosition(position => {
this.addPoint(new GeoPoint(
position.coords.latitude,
position.coords.longitude,
position.coords.altitude
));
});
/* this.addPoint(new GeoPoint(
});*/
this.addPoint(new GeoPoint(
Std.Random(136, 150),
Std.Random(60, 150),
Std.Random(80, 159)
));*/
));
}
/**
......@@ -119,10 +119,16 @@ class HeightMapViewController extends UIViewController {
let x = 0;
let scalingFactor = 50;
let min = (this.model.max - this.model.min) < scalingFactor ? this.model.min - scalingFactor : this.model.min;
/* drawing the values */
ctx.globalAlpha = 1;
ctx.fillStyle = "#029BE8";
ctx.font = "15px Arial";
ctx.textAlign = "left";
for (let point of this.model.points) {
let ordinateVal = Std.Map(point.altitude, min, this.model.max, 0, height * 0.95);
ctx.lineTo(x, height - ordinateVal);
x+=40;
ctx.fillText(point.altitude, x - 50, height - ordinateVal - 16);
}
ctx.lineTo(x - 40, height);
ctx.lineTo(0, height);
......@@ -135,10 +141,10 @@ class HeightMapViewController extends UIViewController {
ctx.fillStyle = "#029BE8";
ctx.fill();
/* drawing the text, not affected by translation through scrolling */
ctx.save();
ctx.setTransform(1,0,0,1,0,0);
ctx.globalAlpha = 1;
ctx.fillStyle = "#555";
ctx.font = "bold 23px Arial";
ctx.textAlign = "right";
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment