mirror of
https://github.com/GoldenCheetah/GoldenCheetah.git
synced 2026-04-15 05:32:21 +00:00
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:
@@ -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;
|
||||
|
||||
@@ -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_;
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user