#include <qapplication.h>
#include <qwt_plot.h>
#include <qwt_symbol.h>
#include <qwt_plot_curve.h>
{
public:
Plot();
~Plot();
private:
};
{
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->attach(this);
}
Plot::~Plot()
{
delete Curve;
}
int main(int argc, char **argv)
{
Plot *p=new Plot();
p->show();
return a.exec();
}
#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();
}
To copy to clipboard, switch view to plain text mode
Bookmarks