discovery
12th November 2011, 16:49
Hello,
I wanted to save a plot as an image and I have a problem with that. I found QwtPlotRender class and renderDocument() method but isn't work as I expected. Small example explain what I mean.
QwtPlot *plot = new QwtPlot(this);
plot->setTitle(trUtf8("Tytuł nowy"));
QwtPlotCurve *curve_samples = new QwtPlotCurve();
curve_samples->attach(plot);
curve_samples->setRawSamples(x, y, 100);
curve_samples->setTitle("Title of cuvere_sample");
curve_samples->setPen(QPen(QColor(Qt::red)));
curve_samples->setCurveAttribute(QwtPlotCurve::Fitted, true);
plot->setAxisTitle(QwtPlot::xBottom, "test");
ui->verticalLayout->addWidget(plot);
QwtPlotRenderer *renderer = new QwtPlotRenderer();
renderer->renderDocument(plot, "/home/discovery/test.png", QSizeF(150, 100));
The problem is with QwtPlotCurve, samples are not saved on image.
7095
Plot in my application.
7096
Plot saved in png file.
Did I do something wrong? I am quite beginner with qwt library
I wanted to save a plot as an image and I have a problem with that. I found QwtPlotRender class and renderDocument() method but isn't work as I expected. Small example explain what I mean.
QwtPlot *plot = new QwtPlot(this);
plot->setTitle(trUtf8("Tytuł nowy"));
QwtPlotCurve *curve_samples = new QwtPlotCurve();
curve_samples->attach(plot);
curve_samples->setRawSamples(x, y, 100);
curve_samples->setTitle("Title of cuvere_sample");
curve_samples->setPen(QPen(QColor(Qt::red)));
curve_samples->setCurveAttribute(QwtPlotCurve::Fitted, true);
plot->setAxisTitle(QwtPlot::xBottom, "test");
ui->verticalLayout->addWidget(plot);
QwtPlotRenderer *renderer = new QwtPlotRenderer();
renderer->renderDocument(plot, "/home/discovery/test.png", QSizeF(150, 100));
The problem is with QwtPlotCurve, samples are not saved on image.
7095
Plot in my application.
7096
Plot saved in png file.
Did I do something wrong? I am quite beginner with qwt library