1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-07-18 12:54:23 +02:00

Fixed broken graph handling

This commit is contained in:
2016-09-19 23:35:04 +02:00
parent e9b32fb582
commit 1957a51570
17 changed files with 130 additions and 147 deletions

View File

@ -30,14 +30,14 @@ void HeartRateGraph::loadGPX(const GPX &gpx, const QList<PathItem *> &paths)
const Graph &graph = gpx.tracks().at(i)->heartRate();
qreal sum = 0, w = 0;
if (graph.y.count() < 2) {
if (graph.size() < 2) {
skipColor();
continue;
}
for (int j = 1; j < graph.y.size(); j++) {
qreal ds = graph.distance.at(j) - graph.distance.at(j-1);
sum += graph.y.at(j) * ds;
for (int j = 1; j < graph.size(); j++) {
qreal ds = graph.at(j).s() - graph.at(j-1).s();
sum += graph.at(j).y() * ds;
w += ds;
}
_avg.append(QPointF(gpx.tracks().at(i)->distance(), sum/w));