Fix slope chart
This commit is contained in:
parent
2ad2119d9d
commit
baff8ee1b4
1 changed files with 8 additions and 6 deletions
|
@ -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,6 +1268,7 @@ 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;
|
||||||
|
if (nextXRaw - prevXRaw > 10) {
|
||||||
nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f;
|
nextY = (nextYRaw - prevYRaw) / (nextXRaw - prevXRaw) * 100f;
|
||||||
values.add(new Entry(nextX, nextY));
|
values.add(new Entry(nextX, nextY));
|
||||||
prevXRaw = nextXRaw;
|
prevXRaw = nextXRaw;
|
||||||
|
@ -1275,6 +1276,7 @@ public class GpxUiHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
OrderedLineDataSet dataSet = new OrderedLineDataSet(values, "", GPXDataSetType.SLOPE);
|
OrderedLineDataSet dataSet = new OrderedLineDataSet(values, "", GPXDataSetType.SLOPE);
|
||||||
dataSet.units = mainUnitY;
|
dataSet.units = mainUnitY;
|
||||||
|
|
Loading…
Reference in a new issue