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

相关推荐
ServBay10 分钟前
为什么 PostgreSQL 就是比 MySQL 香?
数据库·mysql·postgresql
m0_4636722018 分钟前
golang如何实现群聊功能_golang群聊功能实现策略
jvm·数据库·python
_3762715318 分钟前
如何利用 Provide 注入 API 实例?解决组件库依赖全局接口痛点
jvm·数据库·python
工业甲酰苯胺22 分钟前
Redis--集群搭建与主从复制原理
数据库·redis·php
2401_8504916524 分钟前
如何用 keys 与 values 分别提取 Map 的所有键或所有值
jvm·数据库·python
2301_8159019731 分钟前
MySQL从库同步速度慢的硬件原因_分析磁盘性能与内存占用
jvm·数据库·python
2401_8463395631 分钟前
SQL如何检测分组内是否存在满足条件的数据_EXISTS结合分组
jvm·数据库·python
iAm_Ike32 分钟前
Bootstrap中常用的文本颜色、背景颜色及边框色类
jvm·数据库·python
hjhcos35 分钟前
【pgsql】Ubuntu备份和清理数据库postgresql
数据库·ubuntu·postgresql
m0_7414817837 分钟前
CSS如何实现单选按钮自定义样式_利用伪元素隐藏默认UI
jvm·数据库·python