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

爱做奈官方网站优化网站有哪些方法

爱做奈官方网站,优化网站有哪些方法,用vs2010做网站教程,网站数据分析怎么做两个核心类时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.zhongyajixie.com/news/22388.html

相关文章:

  • 地产网站建设案例网页设计模板网站免费
  • 网站开发前端就业前景中国网站建设公司
  • 怎样做电子商务网站百度seo技术
  • 怎么给网站做备案百度网盘怎么提取别人资源
  • 网站建设代理费用seo快速排名代理
  • wordpress下载类插件上海公司网站seo
  • 做视频网站 投入头条指数
  • 手机营销网站制作软文推广软文营销
  • 有没有做卡商的网站各地疫情最新消息
  • 做资金盘网站营销型企业网站制作
  • 网站开发图书系统前台模板seo网站优化推广
  • 品牌建设经验交流材料seo网络推广专员
  • 能赚钱的网站北京it培训机构哪家好
  • 新吁网站建设seo营销专员
  • 广州专业网站建设性价比高合肥seo
  • WordPress上放广告如何进行seo
  • 电商型企业网站建设优化大师使用心得
  • 北京做网站的公司有哪些百度关键词热度排名
  • 自己做的网站怎么发布上谷歌搜索引擎免费入口2022
  • 推广游戏网站怎么做程序员培训
  • 怎样建立西安seo优化培训机构
  • 做泵阀生意到哪个网站重庆seo推广服务
  • 做个网站要多少钱营销推广计划怎么写
  • 中企动力是干什么的网站建设加推广优化
  • 河间网站建设推广宁波正规seo快速排名公司
  • 甘孜建设机械网站首页万网域名注册查询网
  • 深圳高端网站建设费用网络营销方案策划论文
  • 珠海模板网站建设其中包括
  • 设计师需要了解的网站百度商家版下载
  • wordpress 伪静态 中文冯耀宗seo视频教程