QCustomPlot的使用方法
来源:互联网 发布:天津师范大学软件学院 编辑:程序博客网 时间:2024/06/11 01:57
1. 官网下载
去官网下载,最新的版本,地址:http://www.qcustomplot.com/目前最新的是2.0.0 Beta版本,使用起来和老版差不多。
2. 使用方法
(1)将压缩包解压,得到2个文件:qcustomplot.h 和 qcustomplot.cpp,放入项目文件夹。
(3)操作ui
为了能在ui designer里面使用QCustomPlot,可以拖动一个Widget控件到ui设计器上,
对这个窗体点击右键,选择提升为:
把提升的类名填写为QCustomPlot即可,这样就可以使用了,
使用就和我们用普通控件一样,ui->xxx->……
3. 显示图像
(1)重命名你托上去的widget控件,例如 :customPlot
(2)编码
在项目自动生成的代码里面,增加1个函数,例如叫 : showchart();
在showchart()函数中,添加显示图像的代码:
编译,运行,结果:
代码如下:
void Dialog::showchart(){ // generate some data: QVector<double> x(101), y(101); // initialize with entries 0..100 for (int i=0; i<101; ++i) { x[i] = i/50.0 - 1; // x goes from -1 to 1 y[i] = x[i]*x[i]; // let's plot a quadratic function } // create graph and assign data to it: ui->customPlot->addGraph(); ui->customPlot->graph(0)->setData(x, y); // give the axes some labels: ui->customPlot->xAxis->setLabel("x"); ui->customPlot->yAxis->setLabel("y"); // set axes ranges, so we see all data: ui->customPlot->xAxis->setRange(-1, 1); ui->customPlot->yAxis->setRange(0, 1); ui->customPlot->replot();}
完成!
-------------
阅读全文
0 0
- QCustomPlot的使用方法
- qcustomplot使用方法
- QCustomPlot的基本使用
- QCustomPlot的安装使用
- QCustomPlot的简单使用
- QCustomPlot的replot效率
- QCustomPlot的安装使用
- QCustomPlot的用法
- 关于QCustomPlot的绘图
- QCustomPlot
- QCustomPlot的使用 - 1安装
- QCustomPlot绘图控件的使用
- QCustomPlot之绘图的基础
- QCustomPlot的几个主要Class
- QCustomPlot之绘图的基础
- 使用QCustomPlot绘图的基础
- QCustomPlot类的继承图
- QCustomPlot鼠标点选折线上的
- intent详解
- Android 开发:由模块化到组件化(一)
- 功能: winform的enter键跳转功能 (学习日记 2017-05-26)
- react-native-scrollable-tab-view详解
- 3分钟读懂互联网金融风控的应用场景及风控手段
- QCustomPlot的使用方法
- TensorFlow学习之路(0):tf.placeholder() & feed_dict={}
- 软件性能测试完整指南
- 通过Atlas实现MySQL读写分离
- linux中导入数据库命令
- matlab矩阵运算
- ssm框架入门实践
- home键双击灭屏
- 设置好arm-linux-gcc环境变量却提示找不到文件