QCustomPlot
csdn : https://blog.csdn.net/llq108/article/details/45603047
https://blog.csdn.net/guo_lei_lamant/article/details/79826685
https://blog.csdn.net/yxy244/article/details/100311112
下载地址:http://qcustomplot.com/index.php/download
官网:http://qcustomplot.com/index.php/introduction (有例子)
添加QCustomPlot的方法:
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport
将qcustomplot.h和qcustomplot.cpp加入你的工程中
- Qt Designer中使用“提升为”功能
- 直接
QCustomplot *myqcp = new QCustomPlot;
导入第三方库
不用包含qcustomplot.h和qcustomplot.cpp,只需引入qcustomplot.so (GNU/Linux)或qcustomplot.dll(MSWindows) file。接下来说明如何编译qcustomplot库:
首先,从下载地址下载QCustomPlot-sharedlib,然后拷贝qcustomplot.h和qcustomplot.cpp到与qcustomplot-sharedlib同级的目录下,然后在命令行模式进入sharedlib-compilation目录,运行qmake;mingw32-make;稍等片刻就会产生俩个文件夹debug和release,里面分别有qcustomplot库的debug和release版本,windows是.dll,linux是.a
简单使用
ui->customPlot->addGraph(); //有这句才能画图!
ui->customPlot->graph(0)->setPen(QPen(Qt::white));//曲线颜色
ui->customPlot->graph(0)->setData(x, y);//x,y是QVector类型
//QTest::qSleep(500);
ui->customPlot->replot();

浙公网安备 33010602011771号