Fix LTM trend line

.. broken on All Dates selections.

It must be time to introduce a polynomial fit or somesuch
as the linear regress is a little simplistic for most cases.
This commit is contained in:
Mark Liversedge
2013-12-17 13:35:58 +00:00
parent 2ea02dbfd3
commit 8aee630180
3 changed files with 13 additions and 2 deletions

View File

@@ -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);