mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-02-13 16:18:42 +00:00
Generic Plot Cosmetic
.. show x-avg on select at the top of a line chart, stops it overwriting the min/max values. Especially relevant when using a time/date axis hence limiting to a line chart where this is most common.
This commit is contained in:
@@ -284,7 +284,10 @@ void GenericSelectTool::paint(QPainter*painter, const QStyleOptionGraphicsItem *
|
||||
// bottom of plotarea, remember Y-axis range doesn't always start from 0
|
||||
minxp.setY(mapFromScene(host->qchart->plotArea().bottomLeft()).y());
|
||||
maxxp.setY(mapFromScene(host->qchart->plotArea().bottomLeft()).y());
|
||||
avgxp.setY(mapFromScene(host->qchart->plotArea().bottomLeft()).y());
|
||||
|
||||
|
||||
if (host->charttype == GC_CHART_SCATTER) avgxp.setY(mapFromScene(host->qchart->plotArea().bottomLeft()).y()-4);
|
||||
else avgxp.setY(mapFromScene(host->qchart->plotArea().topLeft()).y()+fm.tightBoundingRect("XXX").height()+4);
|
||||
|
||||
QColor linecol=GColor(CPLOTMARKER);
|
||||
linecol.setAlphaF(0.25);
|
||||
@@ -334,7 +337,9 @@ void GenericSelectTool::paint(QPainter*painter, const QStyleOptionGraphicsItem *
|
||||
if (host->charttype == GC_CHART_SCATTER) label=QString("%1").arg(calc.x.mean);
|
||||
else label=QString("%1").arg(calc.x.max - calc.x.min);
|
||||
}
|
||||
painter->drawText(avgxp-QPointF(0,4), label);
|
||||
|
||||
// paint centered
|
||||
painter->drawText(avgxp-QPointF(fm.tightBoundingRect(label).width()/2.0,0), label);
|
||||
|
||||
//
|
||||
// MIN AVG MAX Y VALUE ON PLOT AREA
|
||||
|
||||
Reference in New Issue
Block a user