void MainWindow::on_pushButton_clicked()
{
double xval[5]={10,20,30,40.4,50};
double yval[5]={1,2.2,3,4,5};
// plot->setTitle("first plot");
plot->setTitle("first_plot");
plot
->setAxisTitle
(QwtPlot::xBottom,
" System time [h:m:s]");
plot
->setAxisScale
(QwtPlot::xBottom,
0,
60 );
plot
->setAxisTitle
(QwtPlot::yLeft,
"Degree");
plot
->setAxisScale
(QwtPlot::yLeft,
-60,
60 );
plot->setAutoReplot(true); // not needed
curve1
->setPen
(QPen(Qt
::blue));
curve1->setSamples(xval,yval,5);
curve1->attach(plot);
plot->replot(); // not needed
plot->show();
}
void MainWindow::on_pushButton_clicked()
{
double xval[5]={10,20,30,40.4,50};
double yval[5]={1,2.2,3,4,5};
QwtPlot *plot = new QwtPlot(QwtText("CppQwtExample1"));
// plot->setTitle("first plot");
plot->setTitle("first_plot");
plot->setAxisTitle(QwtPlot::xBottom, " System time [h:m:s]");
plot->setAxisScale(QwtPlot::xBottom, 0,60 );
plot->setAxisTitle(QwtPlot::yLeft, "Degree");
plot->setAxisScale(QwtPlot::yLeft, -60,60 );
plot->setAutoReplot(true); // not needed
QwtPlotCurve *curve1 = new QwtPlotCurve("Curve 1");
curve1->setPen(QPen(Qt::blue));
curve1->setSamples(xval,yval,5);
curve1->attach(plot);
plot->replot(); // not needed
plot->show();
}
To copy to clipboard, switch view to plain text mode
Bookmarks