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

山西设计网站建设爱站关键词

山西设计网站建设,爱站关键词,鱼爪商标交易平台,幼儿园主题网络图设计分析两个核心类时QChart和QLineSeries 下面这个示例代码中&#xff0c;定时器每隔一段时间将曲线图中的数据点向右移动 一个单位&#xff0c;同时调整横坐标轴的范围&#xff0c;实现了一次滚动对应移动一个数据点的效果。 QLineSeries最多容纳40961024个点 #include <QtWidg…

两个核心类时QChart和QLineSeries

下面这个示例代码中,定时器每隔一段时间将曲线图中的数据点向右移动 一个单位,同时调整横坐标轴的范围,实现了一次滚动对应移动一个数据点的效果。

QLineSeries最多容纳4096+1024个点

#include <QtWidgets/QApplication>
#include <QtWidgets/QMainWindow>
#include <QtCharts/QChartView>
#include <QtCharts/QLineSeries>
#include <QtCharts/QValueAxis>
#include <QtCore/QRandomGenerator>
#include <QtCore/QTimer>
#include <QDebug>QT_CHARTS_USE_NAMESPACEint main(int argc, char *argv[])
{QApplication a(argc, argv);QMainWindow window;QChartView *chartView = new QChartView(&window);window.setCentralWidget(chartView);QChart *chart = new QChart();chart->legend()->hide();chartView->setChart(chart);chart->createDefaultAxes();QLineSeries *series = new QLineSeries();chart->addSeries(series);chart->createDefaultAxes();QValueAxis *axisX = qobject_cast<QValueAxis *>(chart->axes(Qt::Horizontal).at(0));QValueAxis *axisY = qobject_cast<QValueAxis *>(chart->axes(Qt::Vertical).at(0));axisY->setRange(0, 120);// 初始化数据点qreal startX = 0;for (int i = 0; i < 100; ++i) {series->append(startX + i, QRandomGenerator::global()->bounded(100));}int currentIndex = 0; // 当前数据点索引QTimer timer;timer.setInterval(100);QObject::connect(&timer, &QTimer::timeout, [&](){if (series->points().size() >= 4096 + 1024){int n = series->points().size() - 4096;series->removePoints(0, n);currentIndex-= n;qDebug() << "remove " << n;}qDebug() << currentIndex;// 移动数据点//series->remove(0);series->append(series->points().last().x() + 1, QRandomGenerator::global()->bounded(100));// 计算滚动后的横坐标范围qreal minX = series->points().at(currentIndex).x();qreal maxX = series->points().last().x();qreal targetMinX = minX + 1;qreal targetMaxX = maxX + 1;axisX->setRange(targetMinX, targetMaxX);currentIndex++;});timer.start();window.resize(800, 600);window.show();return a.exec();
}

.pro文件

QT       += core gui chartsgreaterThan(QT_MAJOR_VERSION, 4): QT += widgetsCONFIG += c++11# The following define makes your compiler emit warnings if you use
# any Qt feature that has been marked deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS# You can also make your code fail to compile if it uses deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0SOURCES += \main.cppHEADERS +=TRANSLATIONS += \myChart_zh_CN.ts# Default rules for deployment.
qnx: target.path = /tmp/$${TARGET}/bin
else: unix:!android: target.path = /opt/$${TARGET}/bin
!isEmpty(target.path): INSTALLS += target

http://www.hkea.cn/news/651282/

相关文章:

  • 宝安附近公司做网站建设多少钱深圳百度开户
  • 成都紧急通知seo网络营销招聘
  • 思坎普网站建设如何做营销推广
  • 太原网站优化公司有域名和服务器怎么建网站
  • 网站策划的前景seo 推广
  • wordpress导入网站文章怎么联系百度人工客服
  • 制冷机电工程东莞网站建设简阳seo排名优化培训
  • 北京网站建设 网站维护服装营销方式和手段
  • 唐山高端网站建设开发新客户的十大渠道
  • 小地方的旅游网站怎么建设seo教程有什么
  • 做网站教程宁波百度seo点击软件
  • asp.net个人网站北京专门做seo
  • 石家庄java开发做网站百度资源站长平台
  • 有哪些网站系统网络营销首先要进行
  • 网站建设硬件设置竞价广告是怎么推广的
  • 网站的平面设计图用ps做国外搜索引擎大全百鸣
  • 深圳专业企业网站建设前端培训
  • 南京平台公司seo搜索培训
  • 横沥网站建设武汉百度百科
  • 百度给做网站公司线上运营的5个步骤
  • 盘锦网站建设公司网络营销策略包括哪些
  • 简述电子商务网站开发的基本原则一站式网络营销
  • 商丘网站网络推广员的工作内容和步骤
  • 取消wordpress邮箱认证北京搜索优化排名公司
  • 千库网素材南宁seo优势
  • 西安机场商务宾馆百度做网站怎么在百度上做网站
  • ps网站建设seo网络公司
  • 网站建设步骤 教 程网站怎么做谷歌推广
  • 网站制作需要注意什么潍坊做网站哪家好
  • 专门做团购的网站有哪些色盲图