Roman Rdgz
Roman Rdgz

Reputation: 13264

QwtPlot: making last plotted point look in a different color or size

I have a system which is drawing points into a QwtPlot. What I want is getting the last plotted point at any time plotted in a different color, so I can always know which has been the last plotted point by the moment.

Is there any direct way of doing this, or how could I approach this?

Upvotes: 0

Views: 1970

Answers (1)

AquilaRapax
AquilaRapax

Reputation: 1099

You could use a QwtPlotMarker. The following code is extracted from the qwt example called "Bode", and is located in a subclass from QwtPlot (i.e. this is a sub-class of QwtPlot):

d_mrk2 = new QwtPlotMarker();
d_mrk2->setLineStyle(QwtPlotMarker::HLine);
d_mrk2->setLabelAlignment(Qt::AlignRight | Qt::AlignBottom);
d_mrk2->setLinePen(QPen(QColor(200,150,0), 0, Qt::DashDotLine));
d_mrk2->setSymbol( QwtSymbol(QwtSymbol::Diamond, QColor(Qt::yellow), QColor(Qt::green), QSize(7,7)));
d_mrk2->attach(this);

and later in the example the marker is located by:

d_mrk2->setValue(x, y);

For further informations have a look at the Qwt "Bode" example, which should be located in the qwt directory.

Upvotes: 2

Related Questions