From 7ce5ffa7eaeecaca55a3e3b0ad9c05a8fa69068f Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Mon, 23 Dec 2013 15:20:18 +0000 Subject: [PATCH] Fixup Stack By Series Finish off the nits and missing pieces for the recent update to enable plotting in a stack by data series; * Now plots W' bal, LR Balance and headwind * Stacks are now redrawn when settings change * Interval marking is fixed * Baseline is now set correctly for each plot * Reference lines are plotted (on power plots only) * Reference lines can be dragged * Interval markers are not redrawn with the text only shown on first plot --- src/AllPlot.cpp | 258 ++++++++++++++++++++++++++---------------- src/AllPlot.h | 11 +- src/AllPlotWindow.cpp | 59 ++++++++-- src/AllPlotWindow.h | 1 + src/RideFile.h | 3 +- 5 files changed, 217 insertions(+), 115 deletions(-) diff --git a/src/AllPlot.cpp b/src/AllPlot.cpp index 1d698fe6b..537a1189a 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): +AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType scope, bool wanttext): QwtPlot(parent), rideItem(NULL), shade_zones(true), @@ -247,7 +247,8 @@ AllPlot::AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType s bydist(false), scope(scope), context(context), - parent(parent) + parent(parent), + wanttext(wanttext) { referencePlot = NULL; @@ -991,7 +992,7 @@ AllPlot::recalc() } void -AllPlot::refreshIntervalMarkers(bool withtext) +AllPlot::refreshIntervalMarkers() { foreach(QwtPlotMarker *mrk, d_mrk) { mrk->detach(); @@ -1015,7 +1016,7 @@ AllPlot::refreshIntervalMarkers(bool withtext) QString name(interval.name); if (interval.name.startsWith(tr("Match"))) name = QString("\n%1").arg(interval.name); - QwtText text(withtext ? name : ""); + QwtText text(wanttext ? name : ""); text.setFont(QFont("Helvetica", 10, QFont::Bold)); if (interval.name.startsWith(tr("Match"))) text.setColor(GColor(CWBAL)); @@ -1032,7 +1033,7 @@ AllPlot::refreshIntervalMarkers(bool withtext) } void -AllPlot::refreshCalibrationMarkers(bool withtext) +AllPlot::refreshCalibrationMarkers() { foreach(QwtPlotMarker *mrk, cal_mrk) { mrk->detach(); @@ -1048,7 +1049,7 @@ AllPlot::refreshCalibrationMarkers(bool withtext) mrk->setLineStyle(QwtPlotMarker::VLine); mrk->setLabelAlignment(Qt::AlignRight | Qt::AlignTop); mrk->setLinePen(QPen(GColor(CPLOTMARKER), 0, Qt::DashDotLine)); - QwtText text(withtext ? ("\n\n"+calibration.name) : ""); + QwtText text(wanttext ? ("\n\n"+calibration.name) : ""); text.setFont(QFont("Helvetica", 9, QFont::Bold)); text.setColor(GColor(CPLOTMARKER)); if (!bydist) @@ -1064,6 +1065,10 @@ AllPlot::refreshCalibrationMarkers(bool withtext) void AllPlot::refreshReferenceLines() { + // only on power based charts + if (scope != RideFile::none && scope != RideFile::watts && + scope != RideFile::NP && scope != RideFile::aPower && scope != RideFile::xPower) return; + foreach(QwtPlotCurve *referenceLine, referenceLines) { referenceLine->detach(); delete referenceLine; @@ -1072,7 +1077,7 @@ AllPlot::refreshReferenceLines() if (rideItem->ride()) { foreach(const RideFilePoint *referencePoint, rideItem->ride()->referencePoints()) { QwtPlotCurve *referenceLine = plotReferenceLine(referencePoint); - referenceLines.append(referenceLine); + if (referenceLine) referenceLines.append(referenceLine); } } } @@ -1080,18 +1085,17 @@ AllPlot::refreshReferenceLines() QwtPlotCurve* AllPlot::plotReferenceLine(const RideFilePoint *referencePoint) { + // only on power based charts + if (scope != RideFile::none && scope != RideFile::watts && + scope != RideFile::NP && scope != RideFile::aPower && scope != RideFile::xPower) return NULL; + QwtPlotCurve *referenceLine = NULL; QVector xaxis; QVector yaxis; - if (bydist) { - xaxis.append(referencePlot == NULL ? smoothDistance.first() : referencePlot->smoothDistance.first()); - xaxis.append(referencePlot == NULL ? smoothDistance.last() : referencePlot->smoothDistance.last()); - } else { - xaxis.append(referencePlot == NULL ? smoothTime.first() : referencePlot->smoothTime.first()); - xaxis.append(referencePlot == NULL ? smoothTime.last() : referencePlot->smoothTime.last()); - } + xaxis << axisScaleDiv(QwtPlot::xBottom).lowerBound(); + xaxis << axisScaleDiv(QwtPlot::xBottom).upperBound(); if (referencePoint->watts != 0) { referenceLine = new QwtPlotCurve(tr("Power Ref")); @@ -1682,7 +1686,7 @@ AllPlot::setDataFromPlot(AllPlot *plot, int startidx, int stopidx) } void -AllPlot::setDataFromPlot(AllPlot *plot, bool first) +AllPlot::setDataFromPlot(AllPlot *plot) { if (plot == NULL) { rideItem = NULL; @@ -1691,9 +1695,6 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) referencePlot = plot; - // You got to give me some data first! - //if (!plot->distanceArray.count() || !plot->timeArray.count()) return; - // reference the plot for data and state rideItem = plot->rideItem; bydist = plot->bydist; @@ -1731,39 +1732,9 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) balanceLCurve->setVisible(false); balanceRCurve->setVisible(false); -#if 0 - // attach appropriate curves - //if (this->legend()) this->legend()->hide(); - if (showW && parent->wpData->TAU > 0) { - - // center the curve title - curveTitle.setYValue(30); - curveTitle.setXValue(2); - - // matches cost - double burnt=0; - int count=0; - foreach(struct Match match, parent->wpData->matches) - if (match.cost > 2000) { //XXX how to decide the threshold for a match? - burnt += match.cost; - count++; - } - - QwtText text(QString("Tau=%1, CP=%2, W'=%3, %4 matches >2kJ (%5 kJ)").arg(parent->wpData->TAU) - .arg(parent->wpData->CP) - .arg(parent->wpData->WPRIME) - .arg(count) - .arg(burnt/1000.00, 0, 'f', 1)); - - text.setFont(QFont("Helvetica", 10, QFont::Bold)); - text.setColor(GColor(CWBAL)); - curveTitle.setLabel(text); - } else { - curveTitle.setLabel(QwtText("")); - } -#endif - QwtPlotCurve *ourCurve = NULL, *thereCurve = NULL; + QwtPlotCurve *ourCurve2 = NULL, *thereCurve2 = NULL; + QwtPlotIntervalCurve *ourICurve = NULL, *thereICurve = NULL; QString title; // which curve are we interested in ? @@ -1809,6 +1780,16 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) } break; + case RideFile::wprime: + { + ourCurve = wCurve; + ourCurve2 = mCurve; + thereCurve = referencePlot->wCurve; + thereCurve2 = referencePlot->mCurve; + title = tr("W'bal"); + } + break; + case RideFile::alt: { ourCurve = altCurve; @@ -1819,7 +1800,8 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) case RideFile::headwind: { - //XXX fixme! QwtPlotIntervalCurve *windCurve; + ourICurve = windCurve; + thereICurve = referencePlot->windCurve; title = tr("Headwind"); } break; @@ -1850,8 +1832,10 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) case RideFile::lrbalance: { - //XXX fixme ourCurve = balanceLCurve; - //XXX fixme ourCurve = balanceRCurve; + ourCurve = balanceLCurve; + ourCurve2 = balanceRCurve; + thereCurve = referencePlot->balanceLCurve; + thereCurve2 = referencePlot->balanceRCurve; title = tr("L/R Balance"); } break; @@ -1877,17 +1861,76 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) } // lets clone ! - if (ourCurve && thereCurve) { + if ((ourCurve && thereCurve) || (ourICurve && thereICurve)) { - // no way to get values, so we run through them - ourCurve->setVisible(true); - ourCurve->attach(this); + if (ourCurve && thereCurve) { + // no way to get values, so we run through them + ourCurve->setVisible(true); + ourCurve->attach(this); - // lets clone the data - QVector array; - for (int i=0; idata()->size(); i++) array << thereCurve->data()->sample(i); + // lets clone the data + QVector array; + for (int i=0; idata()->size(); i++) array << thereCurve->data()->sample(i); - ourCurve->setSamples(array); + ourCurve->setSamples(array); + ourCurve->setYAxis(yLeft); + ourCurve->setBaseline(thereCurve->baseline()); + + // symbol when zoomed in super close + if (array.size() < 150) { + QwtSymbol *sym = new QwtSymbol; + sym->setPen(QPen(GColor(CPLOTMARKER))); + sym->setStyle(QwtSymbol::Ellipse); + sym->setSize(3); + ourCurve->setSymbol(sym); + } else { + QwtSymbol *sym = new QwtSymbol; + sym->setStyle(QwtSymbol::NoSymbol); + sym->setSize(0); + ourCurve->setSymbol(sym); + } + } + + if (ourCurve2 && thereCurve2) { + + ourCurve2->setVisible(true); + ourCurve2->attach(this); + + // lets clone the data + QVector array; + for (int i=0; idata()->size(); i++) array << thereCurve2->data()->sample(i); + + ourCurve2->setSamples(array); + ourCurve2->setYAxis(yLeft); + ourCurve2->setBaseline(thereCurve2->baseline()); + + // symbol when zoomed in super close + if (array.size() < 150) { + QwtSymbol *sym = new QwtSymbol; + sym->setPen(QPen(GColor(CPLOTMARKER))); + sym->setStyle(QwtSymbol::Ellipse); + sym->setSize(3); + ourCurve2->setSymbol(sym); + } else { + QwtSymbol *sym = new QwtSymbol; + sym->setStyle(QwtSymbol::NoSymbol); + sym->setSize(0); + ourCurve2->setSymbol(sym); + } + } + + if (ourICurve && thereICurve) { + + ourICurve->setVisible(true); + ourICurve->attach(this); + + // lets clone the data + QVector array; + for (int i=0; idata()->size(); i++) array << thereICurve->data()->sample(i); + + ourICurve->setSamples(array); + ourICurve->setYAxis(yLeft); + } // x-axis setAxisScale(QwtPlot::xBottom, thereCurve->minXValue(), thereCurve->maxXValue()); @@ -1895,7 +1938,6 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) setAxisVisible(QwtPlot::xBottom, true); // y-axis yLeft - ourCurve->setYAxis(yLeft); setAxisVisible(yLeft, true); setAxisScale(QwtPlot::yLeft, thereCurve->minYValue(), 1.1f * thereCurve->maxYValue()); QwtScaleDraw *sd = new QwtScaleDraw; @@ -1920,33 +1962,17 @@ AllPlot::setDataFromPlot(AllPlot *plot, bool first) // plot grid grid->setVisible(referencePlot->grid->isVisible()); - // symbol when zoomed in super close - if (array.size() < 150) { - QwtSymbol *sym = new QwtSymbol; - sym->setPen(QPen(GColor(CPLOTMARKER))); - sym->setStyle(QwtSymbol::Ellipse); - sym->setSize(3); - ourCurve->setSymbol(sym); - } else { - QwtSymbol *sym = new QwtSymbol; - sym->setStyle(QwtSymbol::NoSymbol); - sym->setSize(0); - ourCurve->setSymbol(sym); - } - - // intervals and calibration - refreshIntervalMarkers(first); - refreshCalibrationMarkers(first); - -#if 0 - QwtPlotCurve *wCurve; - QwtPlotCurve *mCurve; - QwtPlotCurve *lrCurve; - //XXX setgrids, shade zones etc etc etc etc + // plot markers etc + refreshIntervalMarkers(); + refreshCalibrationMarkers(); refreshReferenceLines(); + + // always draw against yLeft in series mode + intervalHighlighterCurve->setYAxis(yLeft); + intervalHighlighterCurve->setBaseline(thereCurve->minYValue()); +#if 0 refreshZoneLabels(); #endif - } } @@ -2580,9 +2606,14 @@ AllPlot::eventFilter(QObject *obj, QEvent *event) void AllPlot::plotTmpReference(int axis, int x, int y) { + // only on power based charts + if (scope != RideFile::none && scope != RideFile::watts && + scope != RideFile::NP && scope != RideFile::aPower && scope != RideFile::xPower) return; + if (x>0) { - RideFilePoint *refPoint = new RideFilePoint(); - refPoint->watts = invTransform(axis, y); + + RideFilePoint *referencePoint = new RideFilePoint(); + referencePoint->watts = invTransform(axis, y); foreach(QwtPlotCurve *curve, tmpReferenceLines) { if (curve) { @@ -2592,20 +2623,46 @@ AllPlot::plotTmpReference(int axis, int x, int y) } tmpReferenceLines.clear(); - tmpReferenceLines.append(parent->allPlot->plotReferenceLine(refPoint)); - parent->allPlot->replot(); + // only plot if they are relevant to the plot. + QwtPlotCurve *referenceLine = parent->allPlot->plotReferenceLine(referencePoint); + if (referenceLine) { + tmpReferenceLines.append(referenceLine); + parent->allPlot->replot(); + } + + // now do the series plots + foreach(AllPlot *plot, parent->seriesPlots) { + QwtPlotCurve *referenceLine = plot->plotReferenceLine(referencePoint); + if (referenceLine) { + tmpReferenceLines.append(referenceLine); + plot->replot(); + } + } + + // now the stack plots foreach(AllPlot *plot, parent->allPlots) { - tmpReferenceLines.append(plot->plotReferenceLine(refPoint)); + QwtPlotCurve *referenceLine = plot->plotReferenceLine(referencePoint); + if (referenceLine) { + tmpReferenceLines.append(referenceLine); + plot->replot(); + } + } + + + } else { + + // wipe any we don't want + foreach(QwtPlotCurve *curve, tmpReferenceLines) { + if (curve) { + curve->detach(); + delete curve; + } + } + tmpReferenceLines.clear(); + parent->allPlot->replot(); + foreach(AllPlot *plot, parent->seriesPlots) { plot->replot(); } - } else { - foreach(QwtPlotCurve *curve, tmpReferenceLines) { - if (curve) { - curve->detach(); - delete curve; - } - } - tmpReferenceLines.clear(); parent->allPlot->replot(); foreach(AllPlot *plot, parent->allPlots) { plot->replot(); @@ -2620,6 +2677,9 @@ AllPlot::refreshReferenceLinesForAllPlots() foreach(AllPlot *plot, parent->allPlots) { plot->refreshReferenceLines(); } + foreach(AllPlot *plot, parent->seriesPlots) { + plot->refreshReferenceLines(); + } } void diff --git a/src/AllPlot.h b/src/AllPlot.h index 7429294b5..1041a7b24 100644 --- a/src/AllPlot.h +++ b/src/AllPlot.h @@ -61,14 +61,16 @@ class AllPlot : public QwtPlot public: // you can declare which series to plot, none means do them all - AllPlot(AllPlotWindow *parent, Context *context, RideFile::SeriesType series = RideFile::none); + // wanttext is to say if plot markers should have text + AllPlot(AllPlotWindow *parent, Context *context, + RideFile::SeriesType series = RideFile::none, bool wanttext = true); bool eventFilter(QObject *object, QEvent *e); // set the curve data e.g. when a ride is selected void setDataFromRide(RideItem *_rideItem); void setDataFromPlot(AllPlot *plot, int startidx, int stopidx); - void setDataFromPlot(AllPlot *plot, bool first = false); // used for single series plotting + void setDataFromPlot(AllPlot *plot); // used for single series plotting // convert from time/distance to index in *smoothed* datapoints int timeIndex(double) const; @@ -77,8 +79,8 @@ class AllPlot : public QwtPlot // plot redraw functions bool shadeZones() const; void refreshZoneLabels(); - void refreshIntervalMarkers(bool withtext=true); - void refreshCalibrationMarkers(bool withtext=true); + void refreshIntervalMarkers(); + void refreshCalibrationMarkers(); void refreshReferenceLines(); void refreshReferenceLinesForAllPlots(); void setAxisTitle(QwtAxisId axis, QString label); @@ -128,6 +130,7 @@ class AllPlot : public QwtPlot RideItem *rideItem; AllPlotBackground *bg; QSettings *settings; + bool wanttext; // controls bool shade_zones; diff --git a/src/AllPlotWindow.cpp b/src/AllPlotWindow.cpp index 4083ee629..cd63c39fe 100644 --- a/src/AllPlotWindow.cpp +++ b/src/AllPlotWindow.cpp @@ -1092,7 +1092,7 @@ AllPlotWindow::plotPickerMoved(const QPoint &pos) if (showStack->isChecked()) { // need to highlight across stacked plots - foreach (AllPlot *_plot, allPlots) { + foreach (AllPlot *_plot, (showBySeries->isChecked() ? seriesPlots : allPlots)) { // mark the start of selection on every plot _plot->allMarker1->setValue(plot->allMarker1->value()); @@ -1342,6 +1342,9 @@ AllPlotWindow::setShowPower(int value) plot->replot(); stackFrame->setUpdatesEnabled(true); // don't repaint whilst we do this... } + + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1355,6 +1358,8 @@ AllPlotWindow::setShowHr(int value) allPlot->setShowHr(checked); foreach (AllPlot *plot, allPlots) plot->setShowHr(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1371,6 +1376,8 @@ AllPlotWindow::setShowNP(int value) allPlot->setShowNP(checked); foreach (AllPlot *plot, allPlots) plot->setShowNP(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1387,6 +1394,8 @@ AllPlotWindow::setShowXP(int value) allPlot->setShowXP(checked); foreach (AllPlot *plot, allPlots) plot->setShowXP(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1403,6 +1412,8 @@ AllPlotWindow::setShowAP(int value) allPlot->setShowAP(checked); foreach (AllPlot *plot, allPlots) plot->setShowAP(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1416,6 +1427,8 @@ AllPlotWindow::setShowSpeed(int value) allPlot->setShowSpeed(checked); foreach (AllPlot *plot, allPlots) plot->setShowSpeed(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1429,6 +1442,8 @@ AllPlotWindow::setShowCad(int value) allPlot->setShowCad(checked); foreach (AllPlot *plot, allPlots) plot->setShowCad(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1442,6 +1457,8 @@ AllPlotWindow::setShowAlt(int value) allPlot->setShowAlt(checked); foreach (AllPlot *plot, allPlots) plot->setShowAlt(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1455,6 +1472,8 @@ AllPlotWindow::setShowTemp(int value) allPlot->setShowTemp(checked); foreach (AllPlot *plot, allPlots) plot->setShowTemp(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1468,6 +1487,9 @@ AllPlotWindow::setShowWind(int value) allPlot->setShowWind(checked); foreach (AllPlot *plot, allPlots) plot->setShowWind(checked); + + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1492,6 +1514,8 @@ AllPlotWindow::setShowW(int value) redrawStackPlot(); } + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1505,6 +1529,8 @@ AllPlotWindow::setShowTorque(int value) allPlot->setShowTorque(checked); foreach (AllPlot *plot, allPlots) plot->setShowTorque(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1517,6 +1543,8 @@ AllPlotWindow::setShowBalance(int value) allPlot->setShowBalance(checked); foreach (AllPlot *plot, allPlots) plot->setShowBalance(checked); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1550,6 +1578,8 @@ AllPlotWindow::setShowGrid(int value) allPlot->setShowGrid(value); foreach (AllPlot *plot, allPlots) plot->setShowGrid(value); + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1567,6 +1597,8 @@ AllPlotWindow::setPaintBrush(int value) plot->setPaintBrush(value); active = false; + // and the series stacks too + forceSetupSeriesStackPlots(); // scope changed so force redraw } void @@ -1613,10 +1645,8 @@ AllPlotWindow::resetSeriesStackedDatas() if (!current) return; // just reset from AllPlot - bool first = true; foreach(AllPlot *p, seriesPlots) { - p->setDataFromPlot(allPlot, first); - first = false; + p->setDataFromPlot(allPlot); } } // @@ -1785,6 +1815,13 @@ AllPlotWindow::showBySeriesChanged(int value) showStackChanged(showStack->checkState()); // force replot etc } +void +AllPlotWindow::forceSetupSeriesStackPlots() +{ + setupSeriesStack = false; + setupSeriesStackPlots(); +} + void AllPlotWindow::setupSeriesStackPlots() { @@ -1803,29 +1840,29 @@ AllPlotWindow::setupSeriesStackPlots() QList serieslist; - // lets get a list of what we need to plot + // lets get a list of what we need to plot -- plot is same order as options in settings if (showPower->currentIndex() < 2 && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::watts; if (showHr->isChecked() && rideItem->ride()->areDataPresent()->hr) serieslist << RideFile::hr; - if (showCad->isChecked() && rideItem->ride()->areDataPresent()->cad) serieslist << RideFile::cad; if (showSpeed->isChecked() && rideItem->ride()->areDataPresent()->kph) serieslist << RideFile::kph; - if (showTorque->isChecked() && rideItem->ride()->areDataPresent()->nm) serieslist << RideFile::nm; + 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 (showBalance->isChecked() && rideItem->ride()->areDataPresent()->lrbalance) serieslist << RideFile::lrbalance; + 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; if (showAP->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::aPower; - //if (showW->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::bpm; + if (showW->isChecked() && rideItem->ride()->areDataPresent()->watts) serieslist << RideFile::wprime; + if (showBalance->isChecked() && rideItem->ride()->areDataPresent()->lrbalance) serieslist << RideFile::lrbalance; bool first = true; foreach(RideFile::SeriesType x, serieslist) { // create that plot - AllPlot *_allPlot = new AllPlot(this, context, x); + AllPlot *_allPlot = new AllPlot(this, context, x, first); _allPlot->setAutoFillBackground(false); _allPlot->setPalette(palette); - _allPlot->setDataFromPlot(allPlot, first); // will clone all settings and data for the series + _allPlot->setDataFromPlot(allPlot); // will clone all settings and data for the series // being plotted, only works for one series plotting first = false; diff --git a/src/AllPlotWindow.h b/src/AllPlotWindow.h index d9be08115..e6ec13454 100644 --- a/src/AllPlotWindow.h +++ b/src/AllPlotWindow.h @@ -229,6 +229,7 @@ class AllPlotWindow : public GcChartWindow // reset/redraw all the plots void setupStackPlots(); + void forceSetupSeriesStackPlots(); void setupSeriesStackPlots(); void redrawAllPlot(); void redrawFullPlot(); diff --git a/src/RideFile.h b/src/RideFile.h index 4ad19f800..5ce0986dd 100644 --- a/src/RideFile.h +++ b/src/RideFile.h @@ -111,7 +111,8 @@ class RideFile : public QObject // QObject to emit signals virtual ~RideFile(); // Working with DATASERIES - enum seriestype { secs=0, cad, hr, km, kph, nm, watts, alt, lon, lat, headwind, slope, temp, interval, NP, xPower, vam, wattsKg, lrbalance, aPower, none }; + enum seriestype { secs=0, cad, hr, km, kph, nm, watts, alt, lon, lat, headwind, slope, temp, + interval, NP, xPower, vam, wattsKg, lrbalance, aPower, wprime, none }; enum specialValues { noTemp = -255 }; typedef enum seriestype SeriesType;