From cc7bbbec482d82bc03f14edc9837337c0e0dfe26 Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Wed, 3 Jun 2015 21:37:09 +0100 Subject: [PATCH] Plot Sustained on CP plot in compare mode .. compare seasons --- src/CPPlot.cpp | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/src/CPPlot.cpp b/src/CPPlot.cpp index b20b5c5a1..3cc4d2a09 100644 --- a/src/CPPlot.cpp +++ b/src/CPPlot.cpp @@ -2254,6 +2254,54 @@ CPPlot::calculateForDateRanges(QList compareDateRanges) // overwrite ymax for VAM - if a proper value was found if (rideSeries == RideFile::vam && vamYMax > 0) ymax = vamYMax; } + + if (!showDelta && showEffort) { + + // show the efforts for each date range + QwtSymbol *sym = new QwtSymbol; + sym->setStyle(QwtSymbol::Ellipse); + sym->setSize(4); + QColor col= compareDateRanges[j].color; + col.setAlpha(128); + sym->setBrush(col); + sym->setPen(QPen(Qt::NoPen)); + + // create a curve + QwtPlotCurve *effortCurve = new QwtPlotCurve(); + effortCurve->setSymbol(sym); + effortCurve->setStyle(QwtPlotCurve::Dots); + effortCurve->setRenderHint(QwtPlotItem::RenderAntialiased); + + intervalCurves << effortCurve; + + // size for all rides, can increase if needed + QVector xvals; + QVector yvals; + + int count=0; + foreach(RideItem *r, compareDateRanges[j].context->athlete->rideCache->rides()) { + + // does it match ? + if (!compareDateRanges[j].specification.pass(r)) continue; + + // add the intervals + foreach(IntervalItem *i, r->intervals(RideFileInterval::EFFORT)) { + + // is it a silly value? + if (i->getForSymbol("average_power") > 3000) continue; + + xvals << i->getForSymbol("workout_time") / 60.0f; + yvals << i->getForSymbol("average_power"); + count++; + } + } + + if (count) { + // set the data and attach to the plot + effortCurve->setSamples(xvals.constData(), yvals.constData(), count); + effortCurve->attach(this); + } + } } }