1
0
mirror of https://github.com/tumic0/GPXSee.git synced 2025-03-18 04:27: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) { if (primary) {
_avg.append(QPointF(track.distance(), gi->avg())); _avg.append(QPointF(track.distance(), gi->avg()));
_mavg.append(QPointF(track.distance(), gi->mavg())); _mavg.append(QPointF(track.distance(), gi->mavg()));
_max.append(QPointF(track.distance(), gi->max()));
} }
return gi; return gi;
@ -117,6 +118,16 @@ qreal SpeedGraph::avg() const
return (sum / w); 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() void SpeedGraph::clear()
{ {
qDeleteAll(_tracks); qDeleteAll(_tracks);
@ -124,6 +135,7 @@ void SpeedGraph::clear()
_avg.clear(); _avg.clear();
_mavg.clear(); _mavg.clear();
_max.clear();
GraphTab::clear(); GraphTab::clear();
} }

View File

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