简单的使用Qt的QCustomplot画图
一、新建一个widget工程
二、将Qcustomplot文件复制到项目下
三、右键qt项目增加已存在的文件
四、在.pro中添加
QT += widgets printsupport
五、在.h中添加声明
private:
QCustomPlot *myPlot;
六、在.cpp中的构造函数中添加
myPlot = new QCustomPlot(this);
this->resize(,);
myPlot->resize(,);
// generate some data:
QVector<double> x(), y(); // initialize with entries 0..100
for (int i=; i<; ++i)
{
x[i] = i/50.0 - ; // x goes from -1 to 1
y[i] = 0.75; // let's plot a quadratic function
}
// create graph and assign data to it:
myPlot->addGraph();
myPlot->graph()->setData(x, y);
// give the axes some labels:
myPlot->xAxis->setLabel("x");
myPlot->yAxis->setLabel("y");
// set axes ranges, so we see all data:
myPlot->xAxis->setRange(-, );
myPlot->yAxis->setRange(, );
就画出来一条直线了~
简单的使用Qt的QCustomplot画图的更多相关文章
- Qt之QCustomPlot(图形库)
简述 QCustomPlot是一个基于Qt C++的图形库,用于绘制和数据可视化 - 制作漂亮的2D图 - 曲线图.趋势图.坐标图.柱状图等,并为实时可视化应用程序提供高性能服务.它没有进一步的依赖关 ...
- Qt之QCustomPlot绘图(一)配置和第一个例子
最近一个用Qt开发的项目需要绘制坐标曲线,我在老师的指点下使用了QCustomPlot这个插件,使用方法简单,功能还算不错. 可是在网上找了很多资料和博文都只是将官方提供的例子演示一遍,没有系统全面的 ...
- Qt使用QCustomPlot开发
一.入门 1.下载源文件http://www.qcustomplot.com/: 2.把.cpp和.h放在工程目录下,并将cpp和h加入工程: 3.在.pro中:QT += printsupport: ...
- Qt:QCustomPlot使用教程(三)——用户交互
0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - User Interactions 本节内容是使用QCustomPlot实现绘图和用户交互功能. 本文代码中 ...
- Qt:QCustomPlot使用教程(二)——基本绘图
0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - Basic Plotting 本节内容是使用QCustomPlot进行基本绘图. 本节教程都使用custom ...
- Qt:QCustomPlot使用教程(一)——安装与配置
0.说明 本节翻译总结自:Qt Plotting Widget QCustomPlot - Setting Up 本节的内容是讲如何配置QCustomPlot,而QCustomPlot的具体用法可以看 ...
- QT之QCustomPlot(二)
怎么设置X,Y轴位置 Manages a single axis inside a QCustomPlot. Usually doesn't need to be instantiated exter ...
- QT之QCustomPlot(一)
QDetectPlot::QDetectPlot(QWidget *parent) : QCustomPlot(parent) { QVector<), y(); // initialize w ...
- 如何写一个简单的基于 Qt 框架的 HttpServer ?
httpserver.h #ifndef HTTPSERVER_H #define HTTPSERVER_H #include <QObject> #include <QtCore& ...
随机推荐
- Vue学习笔记【28】——Vue路由(使用 children 属性实现路由嵌套)
使用 children 属性实现路由嵌套 <div id="app"> <router-link to="/account"> ...
- 【Dart学习】--Dart之正则表达式相关方法总结
一,部分属性 RegExp exp = new RegExp(r"(\w+)"); 返回正则表达式的哈希码 print(exp.hashCode); 正则表达式是否区分大小写 pr ...
- AcWing 231. 天码 (容斥)打卡
题目:https://www.acwing.com/problem/content/233/ 题意:给你n个不同的数,让你选取一个四元组,gcd为1,让你求这样的四元组数量是多少 思路:我们单独直接去 ...
- centos6 sersync2使用
接收端rsyncd搭建 http://www.cnblogs.com/hanxiaohui/p/8675409.html 推送端sersync2使用 安装 源码包D:\share\src\sersyn ...
- react jsx 中使用 switch case 示例
<div> <span>适用平台:</span> <span>{(() => { switch (currentItems.usePlatform ...
- 用 Flask 来写个轻博客 (5) — (M)VC_SQLAlchemy 的 CRUD 详解
Blog 项目源码:https://github.com/JmilkFan/JmilkFan-s-Blog 目录 目录 前文列表 扩展阅读 SQLAlchemy 的 CRUD Create 增添数据 ...
- 2019牛客多校第六场J-Upgrading Technology(枚举+单调队列)
Upgrading Technology 题目传送门 解题思路 对于这题,我们可以枚举一个k从0~m,表示当前我们把所有技能最少升到了k级,且至少有一个为k级. 此时我们刚好获得了前k个d[]的收益, ...
- jwt token校验获取用户数据
/** * 用户登录成功之后,获取用户信息 * 1.获取用户id * 2.根据id查询用户 * 3.构建返回值对象 * 4.返回数据 * @return */@RequestMapping(value ...
- 注解深入浅出之Retrofit中的注解(三)
更多andorid高级架构进阶视频免费分享学习请点击:https://space.bilibili.com/474380680 Retrofit中的注解 @Query,@QueryMap,@Field ...
- redis的一些特性
Redis内存回收 Redis复制原理 Redis提供的高可用方案 Redis提供的分片算法 Redis迁移