Charts downsize the pen from 3 to 2. Some nicer looking graphs.

Fri, 11 Nov 2022 15:04:23 +0100

author
Michiel Broek <mbroek@mbse.eu>
date
Fri, 11 Nov 2022 15:04:23 +0100
changeset 434
ebf4996ab396
parent 433
40d4d2bb5f11
child 435
6f84ab6125ad

Charts downsize the pen from 3 to 2. Some nicer looking graphs.

src/ChartCarbonate.cpp file | annotate | diff | comparison | revisions
src/ChartFermenter.cpp file | annotate | diff | comparison | revisions
src/ChartiSpindel.cpp file | annotate | diff | comparison | revisions
src/EditProductTab9.cpp file | annotate | diff | comparison | revisions
translations/bmsapp_en.ts file | annotate | diff | comparison | revisions
translations/bmsapp_nl.ts file | annotate | diff | comparison | revisions
--- a/src/ChartCarbonate.cpp	Mon Nov 07 15:02:16 2022 +0100
+++ b/src/ChartCarbonate.cpp	Fri Nov 11 15:04:23 2022 +0100
@@ -60,7 +60,7 @@
     temperature->setColor(QColorConstants::Svg::red);
     pressure->setName(tr("Pressure bar"));
     QPen pen(QColorConstants::Svg::navy);
-    pen.setWidth(3);
+    pen.setWidth(2);
     pressure->setPen(pen);
 
     chart = new QChart();
--- a/src/ChartFermenter.cpp	Mon Nov 07 15:02:16 2022 +0100
+++ b/src/ChartFermenter.cpp	Fri Nov 11 15:04:23 2022 +0100
@@ -44,11 +44,13 @@
     buttonBox->setStandardButtons(QDialogButtonBox::Ok);
     buttonBox->addButton(saveButton,QDialogButtonBox::ActionRole);
 
-    QSplineSeries *pv_air = new QSplineSeries();
-    QSplineSeries *pv_beer = new QSplineSeries();
-    QSplineSeries *pv_chiller = new QSplineSeries();
-    QSplineSeries *pwr_cool = new QSplineSeries();
-    QSplineSeries *pwr_heat = new QSplineSeries();
+    QLineSeries *pv_air = new QLineSeries();
+    QLineSeries *pv_beer = new QLineSeries();
+    QLineSeries *pv_chiller = new QLineSeries();
+    QLineSeries *pwr_cool1 = new QLineSeries();
+    QLineSeries *pwr_cool0 = new QLineSeries();
+    QLineSeries *pwr_heat1 = new QLineSeries();	// Top side of area
+    QLineSeries *pwr_heat0 = new QLineSeries();	// Bottom side of area
 
     query.prepare("SELECT * FROM log_fermenter WHERE code=:code ORDER BY datetime");
     query.bindValue(":code", code);
@@ -59,34 +61,38 @@
         pv_beer->append(timestamp, query.value("temp_beer").toDouble());
         if (query.value("temp_chiller").toDouble() > 0)
             pv_chiller->append(timestamp, query.value("temp_chiller").toDouble());
-        pwr_cool->append(timestamp, query.value("cooler_power").toDouble());
-        pwr_heat->append(timestamp, query.value("heater_power").toDouble());
+	pwr_cool0->append(timestamp, 0);
+        pwr_cool1->append(timestamp, query.value("cooler_power").toInt());
+	pwr_heat0->append(timestamp, 0);
+        pwr_heat1->append(timestamp, query.value("heater_power").toInt());
     }
 
     pv_air->setName(tr("Air"));
     pv_air->setColor(QColorConstants::Svg::lightgreen);
     pv_beer->setName(tr("Beer"));
     QPen pen(QColorConstants::Svg::navy);
-    pen.setWidth(3);
+    pen.setWidth(2);
     pv_beer->setPen(pen);
     pv_chiller->setName(tr("Chiller"));
     pv_chiller->setColor(QColorConstants::Svg::lightsalmon);
     pv_chiller->setOpacity(0.75);
 
+    QAreaSeries *pwr_cool = new QAreaSeries(pwr_cool0, pwr_cool1);
     pwr_cool->setName("Cool %");
-    pwr_cool->setOpacity(0.25);
+    pwr_cool->setOpacity(0.50);
     pwr_cool->setColor(QColorConstants::Blue);
+    QAreaSeries *pwr_heat = new QAreaSeries(pwr_heat0, pwr_heat1);
     pwr_heat->setName("Heat %");
-    pwr_heat->setOpacity(0.25);
+    pwr_heat->setOpacity(0.50);
     pwr_heat->setColor(QColorConstants::Red);
 
     chart = new QChart();
     chart->setTitle(QString("%1 \"%2\"").arg(code).arg(name));
-    chart->addSeries(pwr_cool);
+    chart->addSeries(pwr_cool);		// Order is important, first drawn is lowest layer.
     chart->addSeries(pwr_heat);
     chart->addSeries(pv_chiller);
     chart->addSeries(pv_air);
-    chart->addSeries(pv_beer);
+    chart->addSeries(pv_beer);		// Top layer
 
     QDateTimeAxis *axisX = new QDateTimeAxis;
     axisX->setTickCount(10);
@@ -119,9 +125,9 @@
     pwr_cool->attachAxis(axisYR);
     pwr_heat->attachAxis(axisYR);
 
-    connect(pv_air, &QSplineSeries::hovered, this, &ChartFermenter::tooltip);
-    connect(pv_beer, &QSplineSeries::hovered, this, &ChartFermenter::tooltip);
-    connect(pv_chiller, &QSplineSeries::hovered, this, &ChartFermenter::tooltip);
+    connect(pv_air, &QLineSeries::hovered, this, &ChartFermenter::tooltip);
+    connect(pv_beer, &QLineSeries::hovered, this, &ChartFermenter::tooltip);
+    connect(pv_chiller, &QLineSeries::hovered, this, &ChartFermenter::tooltip);
 
     chartView = new QChartView(chart);
     chartView->setRenderHint(QPainter::Antialiasing);
--- a/src/ChartiSpindel.cpp	Mon Nov 07 15:02:16 2022 +0100
+++ b/src/ChartiSpindel.cpp	Fri Nov 11 15:04:23 2022 +0100
@@ -62,7 +62,7 @@
     temperature->setColor(QColorConstants::Svg::red);
     density->setName(tr("SG"));
     QPen pen(QColorConstants::Svg::navy);
-    pen.setWidth(3);
+    pen.setWidth(2);
     density->setPen(pen);
     battery->setName(tr("Battery"));
     battery->setColor(QColorConstants::Svg::limegreen);
--- a/src/EditProductTab9.cpp	Mon Nov 07 15:02:16 2022 +0100
+++ b/src/EditProductTab9.cpp	Fri Nov 11 15:04:23 2022 +0100
@@ -500,7 +500,7 @@
     }
 
     QPen pen(QColorConstants::Svg::navy);
-    pen.setWidth(3);
+    pen.setWidth(2);
     pv_mlt->setPen(pen);
     QAreaSeries *pwm_mlt = new QAreaSeries(pwm_mlt0, pwm_mlt1);
     pwm_mlt->setName("MLT pwr");
--- a/translations/bmsapp_en.ts	Mon Nov 07 15:02:16 2022 +0100
+++ b/translations/bmsapp_en.ts	Fri Nov 11 15:04:23 2022 +0100
@@ -110,52 +110,52 @@
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="66"/>
+        <location filename="../src/ChartFermenter.cpp" line="70"/>
         <source>Air</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="68"/>
-        <source>Beer</source>
-        <translation type="unfinished"></translation>
-    </message>
-    <message>
         <location filename="../src/ChartFermenter.cpp" line="72"/>
+        <source>Beer</source>
+        <translation type="unfinished"></translation>
+    </message>
+    <message>
+        <location filename="../src/ChartFermenter.cpp" line="76"/>
         <source>Chiller</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="94"/>
+        <location filename="../src/ChartFermenter.cpp" line="100"/>
         <source>Date</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="105"/>
+        <location filename="../src/ChartFermenter.cpp" line="111"/>
         <source>Temp °C</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="116"/>
+        <location filename="../src/ChartFermenter.cpp" line="122"/>
         <source>Power %</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="146"/>
+        <location filename="../src/ChartFermenter.cpp" line="152"/>
         <source>Save Image</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="146"/>
+        <location filename="../src/ChartFermenter.cpp" line="152"/>
         <source>Image (*.png)</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="148"/>
+        <location filename="../src/ChartFermenter.cpp" line="154"/>
         <source>Save File</source>
         <translation type="unfinished"></translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="148"/>
+        <location filename="../src/ChartFermenter.cpp" line="154"/>
         <source>No image file selected.</source>
         <translation type="unfinished"></translation>
     </message>
--- a/translations/bmsapp_nl.ts	Mon Nov 07 15:02:16 2022 +0100
+++ b/translations/bmsapp_nl.ts	Fri Nov 11 15:04:23 2022 +0100
@@ -140,52 +140,52 @@
         <translation>Bewaar</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="66"/>
+        <location filename="../src/ChartFermenter.cpp" line="70"/>
         <source>Air</source>
         <translation>Lucht</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="68"/>
-        <source>Beer</source>
-        <translation>Bier</translation>
-    </message>
-    <message>
         <location filename="../src/ChartFermenter.cpp" line="72"/>
+        <source>Beer</source>
+        <translation>Bier</translation>
+    </message>
+    <message>
+        <location filename="../src/ChartFermenter.cpp" line="76"/>
         <source>Chiller</source>
         <translation>Koeler</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="94"/>
+        <location filename="../src/ChartFermenter.cpp" line="100"/>
         <source>Date</source>
         <translation>Datum</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="105"/>
+        <location filename="../src/ChartFermenter.cpp" line="111"/>
         <source>Temp °C</source>
         <translation>Temp °C</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="116"/>
+        <location filename="../src/ChartFermenter.cpp" line="122"/>
         <source>Power %</source>
         <translation>Power %</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="146"/>
+        <location filename="../src/ChartFermenter.cpp" line="152"/>
         <source>Save Image</source>
         <translation>Opslaan plaatje</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="146"/>
+        <location filename="../src/ChartFermenter.cpp" line="152"/>
         <source>Image (*.png)</source>
         <translation>Plaatje (*.png)</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="148"/>
+        <location filename="../src/ChartFermenter.cpp" line="154"/>
         <source>Save File</source>
         <translation>Bestand opslaan</translation>
     </message>
     <message>
-        <location filename="../src/ChartFermenter.cpp" line="148"/>
+        <location filename="../src/ChartFermenter.cpp" line="154"/>
         <source>No image file selected.</source>
         <translation>Geen plaatjes bestand gekozen.</translation>
     </message>

mercurial