diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index 58f40192a..437e3fccc 100644 --- a/src/AllPlot.cpp +++ b/src/AllPlot.cpp @@ -228,7 +228,7 @@ class TimeScaleDraw: public QwtScaleDraw static inline double max(double a, double b) { if (a > b) return a; else return b; } -AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType scope, bool wanttext): +AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType scope, RideFile::SeriesType secScope, bool wanttext): QwtPlot(parent), rideItem(NULL), shade_zones(true), @@ -246,6 +246,7 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType s showBalance(true), bydist(false), scope(scope), + secondaryScope(secScope), context(context), parent(parent), wanttext(wanttext) @@ -1762,6 +1763,10 @@ AllPlot::setDataFromPlot(AllPlot *plot) { ourCurve = speedCurve; thereCurve = referencePlot->speedCurve; + if (secondaryScope == RideFile::headwind) { + ourICurve = windCurve; + thereICurve = referencePlot->windCurve; + } title = tr("Speed"); } break; diff --git a/src/AllPlot.h b/src/AllPlot.h index 1041a7b24..a5725b58a 100644 --- a/src/AllPlot.h +++ b/src/AllPlot.h @@ -63,7 +63,7 @@ class AllPlot : public QwtPlot // you can declare which series to plot, none means do them all // wanttext is to say if plot markers should have text AllPlot(AllPlotWindow *parent, Context *context, - RideFile::SeriesType series = RideFile::none, bool wanttext = true); + RideFile::SeriesType series = RideFile::none, RideFile::SeriesType secSeries = RideFile::none, bool wanttext = true); bool eventFilter(QObject *object, QEvent *e); @@ -216,6 +216,7 @@ class AllPlot : public QwtPlot // scope of plot (none means all, or just for a specific series RideFile::SeriesType scope; + RideFile::SeriesType secondaryScope; private: Context *context; diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 20ef25f2f..832e4cf3a 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -1804,6 +1804,7 @@ AllPlotWindow::setupSeriesStackPlots() // this is NOT a memory leak (see ZZZ below) seriesPlots.clear(); + bool addHeadwind = false; RideItem* rideItem = current; if (!rideItem || !rideItem->ride() || rideItem->ride()->dataPoints().isEmpty()) return; @@ -1819,7 +1820,7 @@ AllPlotWindow::setupSeriesStackPlots() if (showCad->isChecked() && rideItem->ride()->areDataPresent()->cad) serieslist << RideFile::cad; if (showAlt->isChecked() && rideItem->ride()->areDataPresent()->alt) serieslist << RideFile::alt; if (showTemp->isChecked() && rideItem->ride()->areDataPresent()->temp) serieslist << RideFile::temp; - if (showWind->isChecked() && rideItem->ride()->areDataPresent()->headwind) serieslist << RideFile::headwind; + if (showWind->isChecked() && rideItem->ride()->areDataPresent()->headwind) addHeadwind=true; //serieslist << RideFile::headwind; if (showTorque->isChecked() && rideItem->ride()->areDataPresent()->nm) serieslist << RideFile::nm; if (showNP->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::NP; if (showXP->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::xPower; @@ -1831,7 +1832,7 @@ AllPlotWindow::setupSeriesStackPlots() foreach(RideFile::SeriesType x, serieslist) { // create that plot - AllPlot *_allPlot = new AllPlot(this, context, x, first); + AllPlot *_allPlot = new AllPlot(this, context, x, (addHeadwind && x == RideFile::kph ? RideFile::headwind : RideFile::none), first); _allPlot->setAutoFillBackground(false); _allPlot->setPalette(palette); _allPlot->setDataFromPlot(allPlot); // will clone all settings and data for the series