PDA

View Full Version : qwt display curves



sergio486
11th December 2010, 21:27
Hi everybody
It's my first project with QWT, i'm triyng to display a cloud of dots but the problem that only one point is displayed at (0, 0).



#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_symbol.h>
#include <qwt_plot_curve.h>

class Plot : public QwtPlot
{
public:
Plot();
~Plot();
private:
QwtPlotCurve* Curve;

};

Plot::Plot():Curve(new QwtPlotCurve("MyCurve"))
{
double x[5]={25.0, 32.0, 45.0, 68.0, 91.0};
double y[5]={25.0, 32.0, 45.0, 68.0, 91.0};

this->setAxisScale(xBottom,0.0, 150.0);
this->setAxisScale(yLeft,0.0, 150.0);


this->Curve->setRawSamples(x, y, 5);
this->Curve->setPen(QPen(Qt::red));

this->Curve->setSymbol(new QwtSymbol(QwtSymbol::XCross, Qt::NoBrush,
QPen(Qt::red), QSize(5, 5)));

this->Curve->setStyle(QwtPlotCurve::NoCurve);


this->Curve->attach(this);


}

Plot::~Plot()
{
delete Curve;
}



int main(int argc, char **argv)
{
QApplication a(argc, argv);

Plot *p=new Plot();
p->show();

return a.exec();
}
any one can explain me what goes around ?

Best regard