项目作者: Htallone

项目描述 :
简单的绘制二维曲线交互界面 simple front end for 2D curve plot based on QCustomPlot 1
高级语言: C++
项目地址: git://github.com/Htallone/FigureWindow.git


简单的绘制二维曲线交互界面

simple front end for 2D curve plot based on QCustomPlot 1

基于QCustomPlot 1的,可用于C++程序调试过程中,需要显示结果数据看看的情形;包括简单的交互(选择放大、滚轴放大缩小、拖动平移、双击还原、等比例显示等)和简单的编辑(线形、scatter、颜色、title、label、legend等)。

下载QCustomPlot 1.3.2到当前路径,然后解压

  1. tar -xvzf QCustomPlot.tar.gz

为了实现一些交互,图方便,之前直接在QCustomPlot源码上改了;修改地方在QCP1.patch中

  1. patch -p0 < QCP1.patch

然后就可以利用makefile生成了,测试环境Fedora 28和QT 5.10

  1. make

这里会生成FinWin可执行程序,主函数在demo.cpp中,运行

./FinWin

demo.cpp中列出FigureWindow常见用法,运行结果如图

  1. FigureWindow figWin;
  2. figWin.plot(x1,y1);
  3. figWin.holdon();
  4. figWin.plot(x2,y2,pen1,"x2-y2");
  5. figWin.plot(x3,y3,pen2,QCPScatterStyle(QCPScatterStyle::ssCircle,pen.color(),Qt::white,6),"x3-y3");
  6. figWin.show();

截图1

  1. FigureWindow * figWinP = new FigureWindow;
  2. figWinP->axisequal();
  3. figWinP->plot(x5,y5,pen,"x5-y5");
  4. figWinP->holdon();
  5. figWinP->plot(x6,y6,pen3,"x6-y6");
  6. figWinP->setWindowTitle("x5-y5 VS x6-y6 title");
  7. figWinP->setAxisLabelX("x");
  8. figWinP->setAxisLabelY("y");
  9. figWinP->show();

截图2

  1. FigureSubplotWindow windowSub;
  2. // windowSub.resize(QSize(740,600));
  3. windowSub.subplot(0,0);
  4. windowSub.currentFigure()->plot(x1,y1);
  5. windowSub.currentFigure()->holdon();
  6. windowSub.currentFigure()->setTitle("Figure 1");
  7. windowSub.subplot(0,1);
  8. windowSub.currentFigure()->plot(x2,y2);
  9. windowSub.currentFigure()->holdon();
  10. windowSub.currentFigure()->setTitle("图 2");
  11. windowSub.subplot(1,0);
  12. windowSub.currentFigure()->plot(x3,y3);
  13. windowSub.currentFigure()->holdon();
  14. windowSub.currentFigure()->setTitle("test 3");
  15. windowSub.subplot(1,1);
  16. windowSub.currentFigure()->setTitle("test 4");
  17. windowSub.currentFigure()->plotScatters(x4,y4,QCPScatterStyle(QCPScatterStyle::ssCircle,pen,QBrush(Qt::white),6));
  18. windowSub.currentFigure()->holdon();
  19. windowSub.currentFigure()->plot(x5,y5);
  20. windowSub.show();
  21. windowSub.subplot(1,1);
  22. windowSub.currentFigure()->axisequal();

截图3

其它简单编辑界面截图

Edit

Save-Image

Simple-Edit-Axis

Simple-Edit-Plottables

Simple-Edit-Plottables-Color

Simple-Edit-Plottables-LineStyle

Simple-Edit-Plottables-Scatter

License

GPL

icon文件夹下,部分是使用开源项目(oxygen-icons、qwtplot3d等)的图标,使用各自的License