-
Notifications
You must be signed in to change notification settings - Fork 0
/
frmqwtplot.cpp
42 lines (35 loc) · 1011 Bytes
/
frmqwtplot.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#include "frmqwtplot.h"
#include "ui_frmqwtplot.h"
frmqwtplot::frmqwtplot(QWidget *parent) :
QWidget(parent),
ui(new Ui::frmqwtplot)
{
ui->setupUi(this);
initForm();
}
frmqwtplot::~frmqwtplot()
{
delete ui;
}
void frmqwtplot::initForm()
{
ui->paper->setTitle("XYZ realtime path");
curve = new QwtPlotCurve();
painter = new QwtPlotDirectPainter();
grid = new QwtPlotGrid();
symbol = new QwtSymbol( QwtSymbol::Ellipse,
QBrush( Qt::yellow ), QPen( Qt::red, 2 ), QSize( 8, 8 ) );
curve->setPen( Qt::blue, 4 ),
curve->setRenderHint( QwtPlotItem::RenderAntialiased, true );
curve->setSymbol( symbol );
grid->attach( ui->paper );
}
void frmqwtplot::drawDataPoint(const ST_POS_T &pos)
{
// curve->setSamples( points );
// painter->drawSeries(&points, points.at(points.size()-1), points.at(points.size()-1));
points << QPointF( pos.tick, pos.x );
curve->setSamples( points );
curve->attach( ui->paper );
ui->paper->replot();
}