Is there anyway to genarate an image from the current graph?
Is there anyway to genarate an image from the current graph?
Take a look at this:
bool QCustomPlot::savePng ( const QString & fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1 ); bool QCustomPlot::saveJpg ( const QString & fileName, int width = 0, int height = 0, double scale = 1.0, int quality = -1 ); bool QCustomPlot::saveBmp ( const QString & fileName, int width = 0, int height = 0, double scale = 1.0 ); bool QCustomPlot::saveRastered ( const QString & fileName, int width, int height, double scale, const char * format, int quality = -1 );
QCustomPlot::toPixmap
might also be interesting for you, if you don't want to save the plot to a file directly but want to keep it in program memory at first.
Thank you both for the help, can you guys take a look at this and tell me why am I getting a blank jpg file?
QString outputDir = "C:/Users/lucas_araujo/Documents"; QString fileName = "graph.jpg" ; QFile file(outputDir+"/"+fileName); if (!file.open(QIODevice::WriteOnly|QFile::WriteOnly)) { QMessageBox::warning(0,"Could not create Project File", QObject::tr( "\n Could not create Project File on disk")); } ui->widget->saveJpg( fileName, 0, 0, 1.0, -1 );
Never mind, I figured it out, stupid mistake.
This:
ui->widget->saveJpg( fileName, 0, 0, 1.0, -1 );
ui->widget->saveJpg( outputDir+"/"+fileName, 0, 0, 1.0, -1 );
Hi sir,
I want to create a multiple plot in the same window with having common X axis and separate Y axis. The Separating line between the plots should be horizontal one and it should be movable, so we can drag the line and change the size of the plot. In there anyway to achieve it??
Also I tried compiling the project provided in the download section. But I keep on getting the error "undefined reference to `qMain(int, char**)'".
Is there anyway I can solve this??