qt 画图 持续更新

cpp 复制代码
//    QCustomPlot *customPlot;
    const QVector<double> x = {0, 1, 2, 3, 4, 5};
    const QVector<double> y = {1, 1, 2, 2, 4, 4};
    customPlot = ui->ctp;
    customPlot->setOpenGl(true);
    customPlot->addGraph();
    customPlot->xAxis->setRange(0, 5);
    customPlot->yAxis->setRange(0, 5);
    customPlot->xAxis2->setRange(0, 5);
    customPlot->yAxis2->setRange(0, 5);
    customPlot->xAxis2->setVisible(true);
    customPlot->yAxis2->setVisible(true);
    customPlot->graph(0)->setData(x, y);
    customPlot->legend->setVisible(false);
    customPlot->graph(0)->setLineStyle(QCPGraph::LineStyle::lsLine);  // 设置线性
    //    customPlot->graph(0)->setName("TEST");
    //    customPlot->xAxis->setLabel("x");
    //    customPlot->yAxis->setLabel("y");
    //    customPlot->replot();
//    customPlot->setInteractions(QCP::iRangeDrag | QCP::iRangeZoom);
    customPlot->axisRect(0)->setRangeZoomFactor(0.9, 0.9); // x方向为1.2
    customPlot->setInteractions(QCP::iRangeZoom);

https://www.wenshushu.cn/f/ea09y2n6v8q

https://netcut.cn/1hvhuovht

https://wormhole.app/lXx8k#iose8rYXadDmTS6SjG0lpg

相关推荐
文丑颜不良啊2 分钟前
LeetCode476~500题目解析
java·leetcode
弦儿4 分钟前
MySQL 数据库从入门到实践:SQL 四大分类 + DDL/DML/DQL 全梳理(附全套代码)
数据库
雨落在了我的手上5 分钟前
JavaEE初级(1):计算机是如何⼯作的
java·java-ee
惊讶的猫17 分钟前
Spring AOP
java·开发语言
用户31268748772024 分钟前
Java 异常体系全链路:受检异常到底该不该用
java
一个天蝎座的程序猿26 分钟前
金仓KingbaseES的数据集成软件,我用了一年多,把KDTS和KFS的用法还有踩过的坑一次说清
数据库
泡海椒37 分钟前
JQuick-SQL CASE WHEN 与函数:在查询中构建业务字段
数据库·sql
学到老活到老38 分钟前
集合换成线程安全的,就不用加锁了吗?
java·面试
一个天蝎座的程序猿38 分钟前
2TB传感器数据搬迁记:IoTDB数据导入导出实战详解(CSV/SQL/TsFile全踩了一遍)
数据库
charlotte1024102444 分钟前
Redis 简介:从诞生到数据类型,再到缓存三大问题
数据库·redis·缓存