AllPlot hide empty user data series

.. when using xdata we don't plot a blank curve
   when there isn't any xdata in the activity
This commit is contained in:
Mark Liversedge
2016-07-16 15:55:53 +01:00
parent 32c3b98a99
commit 0260120930
4 changed files with 10 additions and 8 deletions

View File

@@ -3,21 +3,21 @@
////////////////////////////////////////////////////////////////////////////////
QwtPlotGappedCurve::QwtPlotGappedCurve(double gapValue)
: QwtPlotCurve(),
gapValue_(gapValue)
gapValue_(gapValue), naValue_(0)
{
}
////////////////////////////////////////////////////////////////////////////////
QwtPlotGappedCurve::QwtPlotGappedCurve(const QwtText &title, double gapValue)
: QwtPlotCurve(title),
gapValue_(gapValue)
gapValue_(gapValue), naValue_(0)
{
}
////////////////////////////////////////////////////////////////////////////////
QwtPlotGappedCurve::QwtPlotGappedCurve(const QString &title, double gapValue)
: QwtPlotCurve(title),
gapValue_(gapValue)
gapValue_(gapValue) , naValue_(0)
{
}
@@ -38,7 +38,7 @@ void QwtPlotGappedCurve::drawSeries(QPainter *painter, const QwtScaleMap &xMap,
// First non-missed point will be the start of curve section.
double x = sample(i).x();
double y = sample(i).y();
if ((y < -0.001 || y > 0.001) && x - last <= gapValue_) {
if ((y < (naValue_ + -0.001) || y > (naValue_ + 0.001)) && x - last <= gapValue_) {
int start = i-1;
int end = i;

View File

@@ -29,9 +29,12 @@ public:
virtual void drawSeries(QPainter *painter, const QwtScaleMap &xMap,
const QwtScaleMap &yMap, const QRectF &canvRect, int from, int to) const;
void setNAValue(double x) { naValue_=x; }
private:
/// Value that denotes missed Y data at point
double gapValue_;
double gapValue_;
double naValue_;
};
////////////////////////////////////////////////////////////////////////////////

View File

@@ -506,15 +506,13 @@ AllPlotObject::setUserData(QList<UserData*>user)
foreach(UserData *userdata, user) {
// is it empty?
//XXXif (userdata->isEmpty()) continue;
UserObject add;
// create curve
add.name = userdata->name;
add.units = userdata->units;
add.curve = new QwtPlotGappedCurve(userdata->name, 3);
add.curve->setNAValue(RideFile::NA);
add.curve->setPaintAttribute(QwtPlotCurve::FilterPoints, true);
add.curve->setYAxis(QwtAxisId(QwtAxis::yRight, 4 + k)); // for now.
add.curve->attach(plot);

View File

@@ -3663,6 +3663,7 @@ AllPlotWindow::setupSeriesStackPlots()
// and the user series
for(int k=0; k<userDataSeries.count(); k++) {
if (userDataSeries[k]->isEmpty()) continue;
s.one = static_cast<RideFile::SeriesType>(RideFile::none + 1 + k);
s.two = RideFile::none;
serieslist << s;