diff --git a/src/LTMPlot.cpp b/src/LTMPlot.cpp index a26b52f00..c6586fa32 100644 --- a/src/LTMPlot.cpp +++ b/src/LTMPlot.cpp @@ -536,8 +536,8 @@ LTMPlot::setData(LTMSettings *set) // cosmetics QPen cpen = QPen(metricDetail.penColor.darker(200)); - cpen.setWidth(width*2); // double thickness for trend lines - cpen.setStyle(Qt::DotLine); + cpen.setWidth(2); // double thickness for trend lines + cpen.setStyle(Qt::SolidLine); trend->setPen(cpen); if (appsettings->value(this, GC_ANTIALIAS, false).toBool()==true) trend->setRenderHint(QwtPlotItem::RenderAntialiased); @@ -547,6 +547,11 @@ LTMPlot::setData(LTMSettings *set) // perform linear regression LTMTrend regress(xdata.data(), ydata.data(), count); + + // override class variable as doing it temporarily for trend line only + double maxX = 0.5 + groupForDate(settings->end.date(), settings->groupBy) - + groupForDate(settings->start.date(), settings->groupBy); + double xtrend[2], ytrend[2]; xtrend[0] = 0.0; ytrend[0] = regress.getYforX(0.0); diff --git a/src/LTMTrend.cpp b/src/LTMTrend.cpp index 140c87985..a9514ab69 100644 --- a/src/LTMTrend.cpp +++ b/src/LTMTrend.cpp @@ -29,6 +29,10 @@ LTMTrend::LTMTrend(double *xdata, double *ydata, int count) : if (count <= 2) return; for (int i = 0; i < count; i++) { + + // ignore zero points + if (ydata[i] == 0.00) continue; + points++; sumX += xdata[i]; sumY += ydata[i]; diff --git a/src/LTMTrend.h b/src/LTMTrend.h index 72a2aebdc..d64efa9ae 100644 --- a/src/LTMTrend.h +++ b/src/LTMTrend.h @@ -26,6 +26,8 @@ class LTMTrend // Constructor using arrays of x values and y values LTMTrend(double *, double *, int); double getYforX(double x) const { return (a + b * x); } + double intercept() { return a; } + double slope() { return b; } protected: long points;