1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-17 20:17:45 +01:00

Fixed maximal speed info

Display the maximum of all primary graphs, not the maximum of all graphs.
This commit is contained in:
Martin Tůma 2025-03-16 17:14:14 +01:00
parent f34d6b0540
commit 8de6bbe4fb
2 changed files with 14 additions and 1 deletions

View File

@ -64,6 +64,7 @@ GraphItem *SpeedGraph::loadGraph(const Graph &graph, const Track &track,
if (primary) {
_avg.append(QPointF(track.distance(), gi->avg()));
_mavg.append(QPointF(track.distance(), gi->mavg()));
_max.append(QPointF(track.distance(), gi->max()));
}
return gi;
@ -117,6 +118,16 @@ qreal SpeedGraph::avg() const
return (sum / w);
}
qreal SpeedGraph::max() const
{
qreal mv = 0;
for (int i = 0; i < _max.size(); i++)
mv = qMax(mv, _max.at(i).y());
return mv;
}
void SpeedGraph::clear()
{
qDeleteAll(_tracks);
@ -124,6 +135,7 @@ void SpeedGraph::clear()
_avg.clear();
_mavg.clear();
_max.clear();
GraphTab::clear();
}

View File

@ -26,12 +26,13 @@ private:
GraphItem *loadGraph(const Graph &graph, const Track &track,
const QColor &color, bool primary);
qreal avg() const;
qreal max() const {return bounds().bottom();}
qreal max() const;
void setYUnits();
void setInfo();
QVector<QPointF> _avg;
QVector<QPointF> _mavg;
QVector<QPointF> _max;
Units _units;
TimeType _timeType;