Re: Auto scale, but no plot data
Hi all,
This is my first time posting, and my first time trying to use Qwt. I am presently working on Win7 with Qt 5.5.1, and Qwt 6.1.2. I am compiling with VS2013 32. Everything seems to be installed properly, and I am using creator with the Qwt plugin.
I haven't found a lot of examples, but pieced a test program together with what I found and the Qwt documentation.
Current issue...
My program compiles and runs with no warnings.
When I call (update plot), the plot will auto scale the axis to my data but the plot doesn't show any data. It is completely blank.
I have a feeling it is something I am overlooking, or don't know about.
I am stuck and would appreciate any pointers.
Code:
MainWindow
::MainWindow(QWidget *parent
) : ui(new Ui::MainWindow)
{
ui->setupUi(this);
ui->qwtPlot->setTitle("Plot 1");
ui
->qwtPlot
->setAxisTitle
(QwtPlot::xBottom,
"X axis");
ui
->qwtPlot
->setAxisTitle
(QwtPlot::yLeft,
"Y axis");
ui->qwtPlot->setCanvasBackground(Qt::white);
QVector<double> x;
QVector<double> y;
for(int i = 0; i<500; i++)
{
x.push_back(i);
y.push_back(i*i);
}
testCurve.setSamples(x, y);
//testCurve.setRawSamples(x.data(), y.data(), y.size());
myCurve.
setPen(QPen(Qt
::red));
testCurve.attach(ui->qwtPlot);
ui->qwtPlot->replot();
//ui->qwtPlot->show();
}
Also, I just set up another computer exactly the same as previously described, but with VS2010. Same results.
Thanks
Re: Auto scale, but no plot data
testCurve is on the stack and therefore gone, when you leave the constructor of MainWindow.
Concerning examples: there are several in the official tarball.
Uwe
Re: Auto scale, but no plot data
Uwe,
I knew it was something I was overlooking. My plot looks great now.
Thanks for the excellent library, and the assistance.