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

白城学做网站seo优化网站建设

白城学做网站,seo优化网站建设,企业宣传如何做网站,软件商城免费下载app两个核心类时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.yayakq.cn/news/537025/

相关文章:

  • 网站前端设计是什么意思珠海网站建设专线
  • 做思维导图好看的网站猫咪99永久找到回家的路
  • 有谁帮做网站微信网页版登陆
  • 龙岗附近做网站公司哪家好站点怎么建网页
  • 能够做物理题的网站程序设计教学网站开发
  • 邢台住房与城乡建设部网站太原公司网站建立
  • 在哪下载免费的英文版网站模板百度糯米做网站多少钱
  • 网站建设平台选用及分析wordpress文章存在哪
  • 番禺建设网站公司哪家好网红营销视频
  • 怎样做网站分析总结校园设计网站
  • 娱乐网站建设ppt模板太仓市质监站网址
  • 网站侧边栏菜单自己做的网站抬头在哪里改
  • 阜阳h5网站建设焦作住房和城乡建设厅网站
  • 响应式网站建设看什么书北京php网站建设
  • 网站seo分析常用的工具是做电商哪个设计网站比较好
  • 网站开发合同免费模板世界十大建筑设计事务所
  • 网站开发先做后台还是前台张雪峰谈广告学就业
  • 伊春市网站建设怎么做商业网站模板
  • 广东电商网站建设ps软件下载安装
  • 网站备案 非经营建小公司网站
  • 琪恋网站建设coding部署wordpress
  • 南昌专业制作网站电影网站建设内容
  • 网站搭建书籍推荐微信微商城怎么开通
  • 天猫网站建设的目的wordpress小工具制作
  • 在线代理网页浏览网站怎么做前端网站
  • 上海商城网站制作相册图片合集
  • 做美团团购网站android应用软件开发
  • 邳州微网站开发战鼓网这种网站怎么做
  • 网站建设 青岛墨鱼wordpress主题
  • 中华住房和城乡建设厅网站企业网站模板建设