v1.1.0
This commit is contained in:
87
threadpoltchart.cpp
Normal file
87
threadpoltchart.cpp
Normal file
@ -0,0 +1,87 @@
|
||||
#include "threadpoltchart.h"
|
||||
#include <QDebug>
|
||||
|
||||
threadPoltChart::threadPoltChart(QObject *parent)
|
||||
: QThread{parent} {
|
||||
}
|
||||
|
||||
void threadPoltChart::setValue(QVector<int> jd, QString dataName, QDateTime beginTime, QDateTime endTime) {
|
||||
this->jd = jd;
|
||||
this->dataName = dataName;
|
||||
this->beginTime = beginTime;
|
||||
this->endTime = endTime;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void threadPoltChart::run() {
|
||||
Gloab::m_chartViews.clear();
|
||||
Gloab::rule.clear();
|
||||
Gloab::rule.append("状态");
|
||||
for (int i = 0; i < jd.size(); ++i) {
|
||||
int X = 1;
|
||||
emit newCandS();
|
||||
|
||||
// 为每个图表添加数据
|
||||
//判断右侧数据是否为数字型
|
||||
bool isEnum = Gloab::namelist[dataName];
|
||||
if (dataName.contains("版本号")) {
|
||||
isEnum = false;
|
||||
}
|
||||
if (isEnum) {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
if (Gloab::g_param[jd[i]][j].keys().size()<=deleteName.size()) {
|
||||
bool f=true;
|
||||
for(auto key : Gloab::g_param[jd[i]][j].keys()) {
|
||||
if (!deleteName.contains(key)) {
|
||||
f=false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (f) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
if (Gloab::g_param[jd[i]][j][dataName].contains(".")) {
|
||||
emit appSeries(X++, Gloab::g_param[jd[i]][j][dataName].toDouble());
|
||||
} else {
|
||||
emit appSeries(X++, Gloab::g_param[jd[i]][j][dataName].toLongLong());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
|
||||
//更新进度条
|
||||
Gloab::bytesRead++;
|
||||
int percent = Gloab::bytesRead * 100 / Gloab::fileSize;
|
||||
emit setProgressBar(percent);
|
||||
|
||||
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
|
||||
if (temTime >= beginTime && temTime < endTime) {
|
||||
if (Gloab::g_param[jd[i]][j].contains(dataName)) {
|
||||
QString tem1 = Gloab::g_param[jd[i]][j][dataName];
|
||||
if (!Gloab::rule.contains(tem1)) {
|
||||
Gloab::rule.append(tem1);
|
||||
}
|
||||
emit appSeries(X++, Gloab::rule.indexOf(tem1));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
emit setChartView(jd[i], isEnum);
|
||||
}
|
||||
|
||||
emit setWidget();
|
||||
quit();
|
||||
}
|
Reference in New Issue
Block a user