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
This commit is contained in:
Mark Liversedge
2013-12-23 15:20:18 +00:00
parent 80ffb4a3c8
commit 7ce5ffa7ea
5 changed files with 217 additions and 115 deletions

View File

@@ -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<RideFile::SeriesType> 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;