mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
Events on LTM work for different group by
The last patch to show events on the LTM chart only worked when grouping by weeks. This is because the groupby x dimension is baselined to the starting date; i.e. groups always start from 0. This patch fixes displaying events when grouping by days, months or years.
This commit is contained in:
@@ -1385,6 +1385,8 @@ LTMPlot::refreshMarkers(QDate from, QDate to, int groupby)
|
||||
}
|
||||
markers.clear();
|
||||
|
||||
double baseday = groupForDate(from, groupby);
|
||||
|
||||
// seasons and season events
|
||||
foreach (Season s, main->seasons->seasons) {
|
||||
|
||||
@@ -1400,7 +1402,7 @@ LTMPlot::refreshMarkers(QDate from, QDate to, int groupby)
|
||||
QwtText text(s.getName());
|
||||
text.setFont(QFont("Helvetica", 10, QFont::Bold));
|
||||
text.setColor(GColor(CPLOTMARKER));
|
||||
mrk->setValue(double(groupForDate(s.getStart(), groupby)), 0.0);
|
||||
mrk->setValue(double(groupForDate(s.getStart(), groupby)) - baseday, 0.0);
|
||||
mrk->setLabel(text);
|
||||
}
|
||||
|
||||
@@ -1419,7 +1421,7 @@ LTMPlot::refreshMarkers(QDate from, QDate to, int groupby)
|
||||
QwtText text(event.name);
|
||||
text.setFont(QFont("Helvetica", 10, QFont::Bold));
|
||||
text.setColor(GColor(CPLOTMARKER));
|
||||
mrk->setValue(double(groupForDate(event.date, groupby)), 10.0);
|
||||
mrk->setValue(double(groupForDate(event.date, groupby)) - baseday, 10.0);
|
||||
mrk->setLabel(text);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user