3 #include "heartrategraphitem.h"
6 HeartRateGraphItem::HeartRateGraphItem(const Graph
&graph
, GraphType type
,
7 QGraphicsItem
*parent
) : GraphItem(graph
, type
, parent
)
10 _max
= graph
.first().y();
12 for (int i
= 1; i
< graph
.size(); i
++) {
13 qreal y
= graph
.at(i
).y();
14 sum
+= y
* (graph
.at(i
).s() - graph
.at(i
-1).s());
18 _avg
= sum
/graph
.last().s();
20 setToolTip(toolTip());
23 QString
HeartRateGraphItem::toolTip() const
26 QLocale
l(QLocale::system());
28 tt
.insert(tr("Maximum"), l
.toString(max(), 'f', 0)
29 + UNIT_SPACE
+ tr("bpm"));
30 tt
.insert(tr("Average"), l
.toString(avg(), 'f', 0)
31 + UNIT_SPACE
+ tr("bpm"));