当前位置: 首页 > wzjs >正文

青岛网站设计公司推荐seo网络优化师

青岛网站设计公司推荐,seo网络优化师,宁波模板建站哪家好,涿州网站建设推广1.下载并添加qcustomplot.c和qcustomplot.h文件 拖动一个Widget,提升为qcustomplot 成功后是这样的, 改第三行:greaterThan(QT_MAJOR_VERSION, 4): QT widgets printsupport 编译,不报错,出现带坐标轴的界面&#…

1.下载并添加qcustomplot.c和qcustomplot.h文件

在这里插入图片描述
拖动一个Widget,提升为qcustomplot
在这里插入图片描述
在这里插入图片描述
成功后是这样的,
在这里插入图片描述
改第三行:greaterThan(QT_MAJOR_VERSION, 4): QT += widgets printsupport 编译,不报错,出现带坐标轴的界面,成功
在这里插入图片描述

2.生成曲线

mainwindow.h增加定时器等等

#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
#include "qcustomplot.h"  // 引入QCustomPlot头文件QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACEclass MainWindow : public QMainWindow
{Q_OBJECTpublic:MainWindow(QWidget *parent = nullptr);~MainWindow();private:Ui::MainWindow *ui;QCustomPlot *customPlot; // 添加QCustomPlot指针QTimer *dataTimer; // 定时器QVector<double> xData, yData; // 数据存储void updatePlot(); // 更新图表的函数
};#endif // MAINWINDOW_H

main函数增加曲线等

#include "mainwindow.h"#include <QApplication>int main(int argc, char *argv[])
{QApplication a(argc, argv);MainWindow w;w.show();return a.exec();
}
void MainWindow::updatePlot()
{// 生成新的数据点static double time = 0;static double signalValue = 0;// 生成新信号值(如正弦波)signalValue = qSin(time);time += 0.1;// 保存数据xData.append(time);yData.append(signalValue);// 更新图表customPlot->graph(0)->setData(xData, yData);customPlot->xAxis->setRange(time, 10, Qt::AlignRight); // X轴范围保持在最新10秒内customPlot->replot(); // 刷新图表
}

mianwindow.c添加曲线属性以及定时器参数等

#include "mainwindow.h"
#include "ui_mainwindow.h"
#include <QTimer>
#include <QVector>
#include <cmath> // 使用数学函数MainWindow::MainWindow(QWidget *parent): QMainWindow(parent), ui(new Ui::MainWindow)
{ui->setupUi(this);// 初始化QCustomPlotcustomPlot = new QCustomPlot(this);setCentralWidget(customPlot);// 配置图表customPlot->addGraph();customPlot->graph(0)->setPen(QPen(Qt::blue)); // 设置曲线颜色customPlot->xAxis->setLabel("Time (s)");customPlot->yAxis->setLabel("Signal Value");// 启用自动缩放customPlot->xAxis->setRange(0, 10);customPlot->yAxis->setRange(-1, 1);// 初始化定时器dataTimer = new QTimer(this);connect(dataTimer, &QTimer::timeout, this, &MainWindow::updatePlot);dataTimer->start(100); // 每100毫秒更新一次// 初始化数据xData.clear();yData.clear();
}
MainWindow::~MainWindow()
{delete ui;
}

效果:动态正选曲线
在这里插入图片描述

http://www.dtcms.com/wzjs/25865.html

相关文章:

  • 正规网站建设团队是什么个人网站推广
  • 网站建设论文网站建站哪家公司好
  • 企业管理咨询合同书范本百度热搜关键词排名优化
  • web网站建设遵循的原则吉林seo推广
  • 龙华龙岗网站建设公司优化电池充电什么意思
  • 网站建设是什么专业啊线上推广策略
  • 访问网站 流程图网络营销课程去哪里学
  • 网站页面设计知识软文推广怎么写
  • 网站不备案可以做微信小程序么想做推广哪个平台好
  • 安卓网站客户端制作软件免费的网站
  • 重庆今日最新消息重庆seo排名外包
  • 加强县政府网站建设百度问一问人工客服怎么联系
  • dede 企业网站模板下载电视剧百度搜索风云榜
  • 山西建设厅网站查不了今日新闻国际最新消息
  • 网站首页的功能seo外链软件
  • 手机网站开发设计上海网站seo招聘
  • 山网站建设合肥全网优化
  • 公司网站维护如何做分录英文seo是什么
  • 微信模板怎么制作国外网站seo免费
  • 做网站是用wordpress还是DW营销软件培训
  • 网站设计的公司排名百度权重是怎么来的
  • 淘宝网站建设目标是什么深圳纯手工seo
  • 廊坊网站建设哪家好深圳百度seo培训
  • 网站建站收费百度怎么推广自己的产品
  • 网站ip地址查询域名视频推广渠道有哪些
  • 做文字云的网站指数基金什么意思
  • 制作一个网站流程市场推广方法
  • 深圳做企业网站多少钱电商运营公司排名
  • 潍坊建设网站的公司it教育培训机构排名
  • 网站设计怎么做明信片网络外包