简单的使用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& ...
随机推荐
- 获取浏览器IP
public static string GetLoginIP(HttpRequestBase request) { string loginip = " ...
- jdbc blob插入及查询操作
首先建一张表 create table picture( picId ) primary key not null, picName ) not null, picfile image null ) ...
- 使用 nuxt+iview-admin+koa2 开发项目
公司最近在做的一个项目,依然是采用熟悉的vue开发,数据平台因为其数据量大的特点,采用传统的spa模式,首页加载时间很长,而SSR这种方式对于首屏的加载时间优化显而易见,同时还可以方便的进行SEO.因 ...
- 左闭右开线段树 2019牛客多校(第七场)E_Find the median(点代表区间
目录 题意 一种解析 AC_Code @(2019第七场牛客 E_Find the median 左闭右开线段树) 题意 链接:here 我理解的题意就是:初始序列为空,有\(n(400000)\)次 ...
- div绝对居中、宽高自适应、多栏宽度自适应
<style> body { background-color: #e1ddd9; font-size: 12px; font-family: Verdana, Arial, Helvet ...
- The Preliminary Contest for ICPC Asia Shanghai 2019 (B L )
B. Light bulbs 思路:差分 + 离散化, 好不容易懂了差分却没想到离散化,还是要罗老板出马..... AC代码: #include<bits/stdc++.h> using ...
- Django框架(二十七)—— ContentType组件
目录 ContentType组件 一.什么是ContentType组件 二.使用ContentType 三.使用场景总结 ContentType组件 一.什么是ContentType组件 conten ...
- Java拦截过滤器模式
当我们想要对应用程序的请求或响应进行一些预处理/后处理时,使用截取过滤器设计模式. 在将请求传递到实际目标应用程序之前,在请求上定义和应用过滤器. 过滤器可以进行请求的认证/授权/日志记录或跟踪,然后 ...
- Anjular的ng-repeat
Anjular的ng-repeat不会循环一个二维集合中的一维集合.举个例子:集合 list= {1,2,{0,1,2},23,222},small={0,1,2},使用ng-repeat" ...
- 微信小程序 获取用户信息并保存登录状态
微信小程序 获取用户信息并保存登录状态:http://www.360doc.com/content/18/0124/11/9200790_724662071.shtml