This commit is contained in:
2024-09-13 21:26:54 +08:00
parent 25a7b25256
commit 19d21216e4
8 changed files with 43333 additions and 26 deletions

View File

@ -11,4 +11,4 @@ QFile Gloab::file;
qint64 Gloab::fileSize; qint64 Gloab::fileSize;
qint64 Gloab::bytesRead; qint64 Gloab::bytesRead;
QCompleter *Gloab::completer; QCompleter *Gloab::completer;
QVector<double> Gloab::xData,Gloab::yData; QVector<double> Gloab::xData[4],Gloab::yData[4];

View File

@ -29,7 +29,7 @@ public:
static qint64 fileSize; static qint64 fileSize;
static qint64 bytesRead; static qint64 bytesRead;
static QCompleter *completer; static QCompleter *completer;
static QVector<double> xData,yData; static QVector<double> xData[4],yData[4];
}; };

35529
lib/qcustomplot.cpp Normal file

File diff suppressed because it is too large Load Diff

7774
lib/qcustomplot.h Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 12.0.2, 2024-09-13T11:44:52. --> <!-- Written by QtCreator 12.0.2, 2024-09-13T21:26:35. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
@ -99,7 +99,7 @@
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.12.0 (mingw73_64)</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DefaultDisplayName">Qt 5.12.0 (mingw73_64)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.12.0 (mingw73_64)</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.DisplayName">Qt 5.12.0 (mingw73_64)</value>
<value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{edc54fcd-f681-4a0a-ba77-11a1a5c94a66}</value> <value type="QString" key="ProjectExplorer.ProjectConfiguration.Id">{edc54fcd-f681-4a0a-ba77-11a1a5c94a66}</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">0</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveBuildConfiguration">1</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveDeployConfiguration">0</value>
<value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value> <value type="qlonglong" key="ProjectExplorer.Target.ActiveRunConfiguration">0</value>
<valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0"> <valuemap type="QVariantMap" key="ProjectExplorer.Target.BuildConfiguration.0">
@ -255,7 +255,7 @@
<value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseCppDebuggerAuto">true</value>
<value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value> <value type="bool" key="RunConfiguration.UseLibrarySearchPath">true</value>
<value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value> <value type="bool" key="RunConfiguration.UseQmlDebuggerAuto">true</value>
<value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Debug</value> <value type="QString" key="RunConfiguration.WorkingDirectory.default">C:/Work/CQT/Test_01/build-log7-Qt_5_12_0_mingw73_64-Release</value>
</valuemap> </valuemap>
<value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value> <value type="qlonglong" key="ProjectExplorer.Target.RunConfigurationCount">1</value>
</valuemap> </valuemap>

View File

@ -11,7 +11,7 @@ MainWindow::MainWindow(QWidget *parent)
ui->setupUi(this); ui->setupUi(this);
this->setWindowTitle("日志查询工具"); this->setWindowTitle("日志查询工具");
// 创建版本号标签 // 创建版本号标签
m_versionLabel = new QLabel(tr("v1.1.0"), this); m_versionLabel = new QLabel(tr("v1.2.0"), this);
// 将标签添加到状态栏的右端 // 将标签添加到状态栏的右端
ui->statusbar->addPermanentWidget(m_versionLabel); ui->statusbar->addPermanentWidget(m_versionLabel);
@ -102,7 +102,7 @@ void MainWindow::closeProg() {
void MainWindow::setChartView(int jd, bool isEnum) { void MainWindow::setChartView(int jd, bool isEnum) {
// 设置图表标题 // 设置图表标题
QCustPlot *qCustPlot = new QCustPlot(Gloab::xData, Gloab::yData, jd, isEnum, true); QCustPlot *qCustPlot = new QCustPlot(Gloab::xData[jd], Gloab::yData[jd], jd, isEnum, true);
// 将qCustPlot添加到容器中 // 将qCustPlot添加到容器中
Gloab::m_QCView.append(qCustPlot); Gloab::m_QCView.append(qCustPlot);
} }
@ -135,7 +135,7 @@ void MainWindow::setWidget() {
void MainWindow::setPlotChartView(int jd, bool isEnum) { void MainWindow::setPlotChartView(int jd, bool isEnum) {
// 设置图表标题 // 设置图表标题
QCustPlot *qCustPlot = new QCustPlot(Gloab::xData, Gloab::yData, jd, isEnum, false); QCustPlot *qCustPlot = new QCustPlot(Gloab::xData[jd], Gloab::yData[jd], jd, isEnum, false);
// 将qCustPlot添加到容器中 // 将qCustPlot添加到容器中
Gloab::m_QCView.append(qCustPlot); Gloab::m_QCView.append(qCustPlot);
} }

View File

@ -17,12 +17,14 @@ void ThreadChart::run() {
Gloab::m_QCView.clear(); Gloab::m_QCView.clear();
Gloab::rule.clear(); Gloab::rule.clear();
Gloab::rule.append("状态"); Gloab::rule.append("状态");
for (int var = 0; var < 4; ++var) {
Gloab::xData[var].clear();
Gloab::yData[var].clear();
}
//判断右侧数据是否为数字型 //判断右侧数据是否为数字型
bool isEnum = Gloab::namelist[dataName]; bool isEnum = Gloab::namelist[dataName];
for (int i = 0; i < jd.size(); ++i) { for (int i = 0; i < jd.size(); ++i) {
// emit newCandS();
Gloab::xData.clear();
Gloab::yData.clear();
qreal y = 114.514; qreal y = 114.514;
QString tem1 = "无数据"; QString tem1 = "无数据";
// 为每个图表添加数据 // 为每个图表添加数据
@ -37,13 +39,13 @@ void ThreadChart::run() {
if (temTime >= beginTime && temTime < endTime) { if (temTime >= beginTime && temTime < endTime) {
if (!Gloab::g_param[jd[i]][j].contains(dataName)) { if (!Gloab::g_param[jd[i]][j].contains(dataName)) {
if (y != 114.514) { if (y != 114.514) {
Gloab::xData.append(temTime.toMSecsSinceEpoch()/1000.0); Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData.append(y); Gloab::yData[jd[i]].append(y);
} }
} else { } else {
y = Gloab::g_param[jd[i]][j][dataName].toDouble(); y = Gloab::g_param[jd[i]][j][dataName].toDouble();
Gloab::xData.append(temTime.toMSecsSinceEpoch()/1000.0); Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData.append(y); Gloab::yData[jd[i]].append(y);
} }
} }
} }
@ -61,16 +63,16 @@ void ThreadChart::run() {
if (!Gloab::rule.contains(tem1)) { if (!Gloab::rule.contains(tem1)) {
Gloab::rule.append(tem1); Gloab::rule.append(tem1);
} }
Gloab::xData.append(temTime.toMSecsSinceEpoch()/1000.0); Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData.append(Gloab::rule.indexOf(tem1)); Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
} }
} else { } else {
tem1 = Gloab::g_param[jd[i]][j][dataName]; tem1 = Gloab::g_param[jd[i]][j][dataName];
if (!Gloab::rule.contains(tem1)) { if (!Gloab::rule.contains(tem1)) {
Gloab::rule.append(tem1); Gloab::rule.append(tem1);
} }
Gloab::xData.append(temTime.toMSecsSinceEpoch()/1000.0); Gloab::xData[jd[i]].append(temTime.toMSecsSinceEpoch()/1000.0);
Gloab::yData.append(Gloab::rule.indexOf(tem1)); Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
} }
} }
} }

View File

@ -17,13 +17,15 @@ void threadPoltChart::run() {
Gloab::m_QCView.clear(); Gloab::m_QCView.clear();
Gloab::rule.clear(); Gloab::rule.clear();
Gloab::rule.append("状态"); Gloab::rule.append("状态");
for (int var = 0; var < 4; ++var) {
Gloab::xData[var].clear();
Gloab::yData[var].clear();
}
//判断右侧数据是否为数字型 //判断右侧数据是否为数字型
bool isEnum = Gloab::namelist[dataName]; bool isEnum = Gloab::namelist[dataName];
for (int i = 0; i < jd.size(); ++i) { for (int i = 0; i < jd.size(); ++i) {
int X = 1; int X = 1;
Gloab::xData.clear();
Gloab::yData.clear();
// 为每个图表添加数据 // 为每个图表添加数据
if (isEnum) { if (isEnum) {
for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) { for (int j = 0; j < Gloab::g_param[jd[i]].size(); j++) {
@ -49,8 +51,8 @@ void threadPoltChart::run() {
QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz"); QDateTime temTime = QDateTime::fromString(Gloab::g_param[jd[i]][j]["时间"], "yyyy-MM-dd hh:mm:ss:zzz");
if (temTime >= beginTime && temTime < endTime) { if (temTime >= beginTime && temTime < endTime) {
if (Gloab::g_param[jd[i]][j].contains(dataName)) { if (Gloab::g_param[jd[i]][j].contains(dataName)) {
Gloab::xData.append(X++); Gloab::xData[jd[i]].append(X++);
Gloab::yData.append(Gloab::g_param[jd[i]][j][dataName].toDouble()); Gloab::yData[jd[i]].append(Gloab::g_param[jd[i]][j][dataName].toDouble());
} }
} }
} }
@ -68,8 +70,8 @@ void threadPoltChart::run() {
if (!Gloab::rule.contains(tem1)) { if (!Gloab::rule.contains(tem1)) {
Gloab::rule.append(tem1); Gloab::rule.append(tem1);
} }
Gloab::xData.append(X++); Gloab::xData[jd[i]].append(X++);
Gloab::yData.append(Gloab::rule.indexOf(tem1)); Gloab::yData[jd[i]].append(Gloab::rule.indexOf(tem1));
} }
} }
} }