From 7b9db4b508c1dfbe79c7c702f1cd11ffbd05b9bd Mon Sep 17 00:00:00 2001 From: UnavailableDev <69792062+UnavailableDev@users.noreply.github.com> Date: Tue, 25 Oct 2022 16:14:58 +0200 Subject: Added all three line graphs --- client/mainwindow.cpp | 8 ++++++-- client/mainwindow.ui | 37 +++++++++++-------------------------- 2 files changed, 17 insertions(+), 28 deletions(-) diff --git a/client/mainwindow.cpp b/client/mainwindow.cpp index 1e74ed0..d3da553 100644 --- a/client/mainwindow.cpp +++ b/client/mainwindow.cpp @@ -30,6 +30,7 @@ void MainWindow::on_actionRefresh_triggered() { QLineSeries *seriesTemperature = new QLineSeries(); QLineSeries *seriesHumidity = new QLineSeries(); + QLineSeries *seriesPressure = new QLineSeries(); _pChart = new QChart(); if(dbRef.open()){ @@ -41,11 +42,13 @@ void MainWindow::on_actionRefresh_triggered() // seriesTemp->append(queryGraphData.value(0).toInt(), queryGraphData.value(1).toInt()); seriesTemperature->append(i, queryGraphData.value(1).toFloat()); seriesHumidity->append(i, queryGraphData.value(2).toFloat()*100); + seriesPressure->append(i, queryGraphData.value(3).toFloat()); } _pChart->legend()->show(); _pChart->addSeries(seriesTemperature); _pChart->addSeries(seriesHumidity); + _pChart->addSeries(seriesPressure); _pChart->createDefaultAxes(); _pChart->setTitle("Weather data:"); _pChartView = new QChartView(_pChart); @@ -56,7 +59,8 @@ void MainWindow::on_actionRefresh_triggered() } else { QMessageBox::warning(this, "No connection", "Failed to connect"); } -// delete seriesTemperature; -// delete seriesHumidity; + delete seriesTemperature; + delete seriesHumidity; + delete seriesPressure; } diff --git a/client/mainwindow.ui b/client/mainwindow.ui index 4ced639..f08cb23 100644 --- a/client/mainwindow.ui +++ b/client/mainwindow.ui @@ -14,36 +14,18 @@ MainWindow - + - 90 - 80 - 621 - 301 + 300 + 210 + 181 + 51 - - - QLayout::SetDefaultConstraint - - - - - - - - - - - - - - Reload - - - - + + Please load data first + @@ -83,6 +65,9 @@ Refresh + + Ctrl+R + -- cgit v1.2.3