QCustomPlot的用法
来源:互联网 发布:手机拍照赚钱软件 编辑:程序博客网 时间:2024/06/16 12:35
#include <QApplication>#include <QLabel>#include <QLineEdit>#include <QGridLayout>#include <QWidget>#include <qcustomplot.h>#include <QMainWindow>#include <QDebug>int main(int argc, char *argv[]){ QApplication app(argc, argv); //得到数据 QVector<double> x(5),y0(5),y1(5),y2(5); for(int i=0;i<5;i++){ x[i]=i; y0[i]=i+10; y1[i]=i+20; y2[i]=i+50; } //创建QCustomPlot,添加曲线graph,并设置曲线的数据 QCustomPlot *customPlot=new QCustomPlot; customPlot->addGraph(); customPlot->graph(0)->setName("fist line"); customPlot->graph(0)->setData(x,y0); customPlot->addGraph(); customPlot->graph(1)->setName("second line"); customPlot->graph(1)->setData(x,y1); customPlot->addGraph(); customPlot->graph(2)->setName("third line"); customPlot->graph(2)->setData(x,y2); //自适应轴 customPlot->graph(0)->rescaleAxes(true); customPlot->graph(1)->rescaleAxes(true); customPlot->graph(2)->rescaleAxes(true); //显示铭文 customPlot->legend->setVisible(true); //设置customPlot可进行拽托或伸缩 customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); customPlot->axisRect()->setRangeDrag(Qt::Horizontal); //设置允许在某一方向上拽托 customPlot->axisRect()->setRangeZoom(Qt::Horizontal); //设置允许在某一方向上伸缩 QMainWindow window; window.setCentralWidget(customPlot); window.resize(500,300); window.show(); /* //得到数据 QVector<double> x(8),y(8); for(int i=0;i<8;i++){ x[i]=i; y[i]=i*i; } //创建QCustomPlot,添加曲线graph,并设置曲线的数据 QCustomPlot *customPlot=new QCustomPlot; customPlot->addGraph(); customPlot->graph(0)->setName("fist line"); customPlot->graph(0)->setData(x,y); //设置轴 QSharedPointer<QCPAxisTickerText> textTicker(new QCPAxisTickerText); textTicker->addTick(1.0, "Bacteria"); textTicker->addTick(2.0, "Protozoa"); textTicker->addTick(3.0, "Chromista"); textTicker->addTick(4.0, "Plants"); textTicker->addTick(5.0, "Fungi"); textTicker->addTick(6.0, "Animals"); textTicker->addTick(8.0, "Vogons"); customPlot->xAxis->setTicker(textTicker); //自适应轴 customPlot->graph(0)->rescaleAxes(true); //显示铭文 customPlot->legend->setVisible(true); //设置customPlot可进行拽托或放大 customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom); QMainWindow window; window.setCentralWidget(customPlot); window.resize(500,300); window.show();*/ return app.exec();}
0 0
- QCustomPlot的用法
- QCustomPlot的基本使用
- QCustomPlot的安装使用
- QCustomPlot的简单使用
- QCustomPlot的replot效率
- QCustomPlot的安装使用
- 关于QCustomPlot的绘图
- QCustomPlot的使用方法
- QCustomPlot
- QCustomPlot的使用 - 1安装
- QCustomPlot绘图控件的使用
- QCustomPlot之绘图的基础
- QCustomPlot的几个主要Class
- QCustomPlot之绘图的基础
- 使用QCustomPlot绘图的基础
- QCustomPlot类的继承图
- QCustomPlot鼠标点选折线上的
- Qt C++ 小部件 QCustomPlot 的使用
- deepin linux 听歌
- 用caffe做了一件有♂趣♀的事——监黄器
- 深入浅出Java注解
- rails dbconsole
- python多进程中使用pool
- QCustomPlot的用法
- Android工具类
- bundle install rake db:rollback 与 db:migrate:redo的区别
- 组件型指令
- Python 解析配置模块之ConfigParser详解
- 前端网页优化的一些问题以及localStorage
- 消息队列设计精要
- 微信小程序调研文档
- 2015百度校招笔试真题以及解析(二)