33 setMouseTracking(
true);
35 setMinimumSize(64, 64);
36 setSizePolicy(QSizePolicy::MinimumExpanding, QSizePolicy::MinimumExpanding);
38 setCanvasBackground(QColor(64, 64, 64));
41 QwtPlotGrid *grid =
new QwtPlotGrid;
42 grid->setMajorPen(QPen(Qt::gray, 0, Qt::DashLine));
43 grid->setMinorPen(QPen(Qt::lightGray, 0, Qt::DotLine));
44 grid->setPen(QPen(Qt::darkGray, 1, Qt::DotLine));
56 const int STEPS = 100;
65 for (
int i = 0;
i < temp.size();
i++) {
66 points.append(QPointF(temp[
i], gyro[i]));
67 min = qMin(min, temp[i]);
68 max = qMax(max, temp[i]);
71 double step = (max - min) / STEPS;
72 for (
int i = 0;
i < STEPS;
i++) {
73 double t = min + step *
i;
74 double f = coeff[0] + coeff[1] * t + coeff[2] * pow(t, 2) + coeff[3] * pow(t, 3);
75 fit.append(QPointF(t, f));
79 QPen pen = QPen(Qt::DotLine);
80 pen.setColor(QColor(244, 244, 244));
82 dataCurve =
new QwtPlotCurve(
"Gyro");
83 dataCurve->setPen(pen);
84 dataCurve->setSamples(this->points);
85 dataCurve->attach(
this);
88 pen.setStyle(Qt::SolidLine);
89 pen.setColor(QColor(0, 255, 0));
91 fitCurve =
new QwtPlotCurve(
"Fit");
92 fitCurve->setPen(pen);
93 fitCurve->setSamples(fit);
94 fitCurve->attach(
this);
102 void TempCompCurve::clearCurves()
void plotData(QList< double > temp, QList< double > gyro, QList< double > coefficients)
Show calibration data for one of the channels.
TempCompCurve(QWidget *parent=nullptr)