Fix slope chart

This commit is contained in:
Alexey Kulish 2017-02-24 18:36:07 +03:00
parent 2ad2119d9d
commit baff8ee1b4

View file

@ -1247,9 +1247,9 @@ public class GpxUiHelper {
ArrayList<Entry> values = new ArrayList<>(); ArrayList<Entry> values = new ArrayList<>();
List<Elevation> elevationData = analysis.elevationData; List<Elevation> elevationData = analysis.elevationData;
float nextX = 0; float nextX;
float nextY; float nextY;
float nextXRaw = 0; float nextXRaw;
float nextYRaw; float nextYRaw;
float prevXRaw; float prevXRaw;
float prevYRaw; float prevYRaw;
@ -1268,10 +1268,12 @@ public class GpxUiHelper {
nextXRaw += e.distance; nextXRaw += e.distance;
nextYRaw = (float) e.elevation; nextYRaw = (float) e.elevation;
nextX += (float) e.distance / divX; nextX += (float) e.distance / divX;
nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f; if (nextXRaw - prevXRaw > 10) {
values.add(new Entry(nextX, nextY)); nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f;
prevXRaw = nextXRaw; values.add(new Entry(nextX, nextY));
prevYRaw = nextYRaw; prevXRaw = nextXRaw;
prevYRaw = nextYRaw;
}
} }
} }
} }