Hi!
I can't find a solution to solve one problem.
I draw a plot with a simple curve. What I need is:
1) to mark every point with a circle (QwtSymbol::Ellipse) and
2) to provide zooming
I faced with a problem that after a several zooms I get extra strange points that are not lie on the curve and have unreasonable data.
Here is a code example:
public:
void drawPlot();
private:
};
=====================================
{
_curve.
setPen(QPen(Qt
::black));
sym.
setPen(QPen(Qt
::black));
sym.setBrush(brush);
sym.setSize(5);
_curve.setSymbol(sym);
_curve.attach(this);
QwtDoubleRect rect(0, 0, 3000, 3000);
_zoomer->setZoomBase(rect);
drawPlot();
}
void Plot::drawPlot(){
QVector<double> x(3000);
QVector<double> y(3000);
for (int i = 0; i < 3000; i++)
{
x[i] = i;
y[i] = i;
}
_curve.setData(x, y);
replot();
}
class Plot: public QwtPlot{
public:
Plot(QWidget * parent = NULL);
void drawPlot();
private:
QwtPlotCurve _curve;
QwtPlotZoomer * _zoomer;
};
=====================================
Plot::Plot(QWidget *parent) : QwtPlot (parent)
{
_curve.setStyle(QwtPlotCurve::Lines);
_curve.setPen(QPen(Qt::black));
QwtSymbol sym;
sym.setStyle(QwtSymbol::Ellipse);
sym.setPen(QPen(Qt::black));
QBrush brush(Qt::yellow);
sym.setBrush(brush);
sym.setSize(5);
_curve.setSymbol(sym);
_curve.attach(this);
_zoomer = new QwtPlotZoomer (canvas());
_zoomer->setSelectionFlags( QwtPicker::DragSelection | QwtPicker::CornerToCorner );
QwtDoubleRect rect(0, 0, 3000, 3000);
_zoomer->setZoomBase(rect);
drawPlot();
}
void Plot::drawPlot(){
QVector<double> x(3000);
QVector<double> y(3000);
for (int i = 0; i < 3000; i++)
{
x[i] = i;
y[i] = i;
}
_curve.setData(x, y);
replot();
}
To copy to clipboard, switch view to plain text mode
I get this only with a QwtSymbol::Ellipse but never with Rect, Diamond or Cross.
Thanks for any help!
Bookmarks