[chronojump] Encoder barplot show total work (J or Cal)



commit 74f3361aeac2c4d6d6a80a7bc6aaf73b78cbb851
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 29 08:55:48 2020 +0200

    Encoder barplot show total work (J or Cal)

 src/gui/encoderGraphObjects.cs | 18 +++++++++++++++++-
 1 file changed, 17 insertions(+), 1 deletion(-)
---
diff --git a/src/gui/encoderGraphObjects.cs b/src/gui/encoderGraphObjects.cs
index c391a1fa..d376bdb5 100644
--- a/src/gui/encoderGraphObjects.cs
+++ b/src/gui/encoderGraphObjects.cs
@@ -347,6 +347,7 @@ public class EncoderGraphDoPlot
                //know not-discarded phases
                double countValid = 0;
                double sumValid = 0;
+               double workTotal = 0; //can be J or Kcal (shown in cal)
 
                foreach(double d in data)
                {
@@ -826,7 +827,15 @@ public class EncoderGraphDoPlot
                                        countSaved ++;
                                }
                        }
-                       
+
+                       //work
+                       if(iterOk) {
+                               if(preferences.encoderWorkKcal)
+                                       workTotal += ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 
0)).WorkKcalD * 1000; //in cal
+                               else
+                                       workTotal += ((EncoderCurve) encoderCaptureListStore.GetValue (iter, 
0)).WorkJD;
+                       }
+
                        //add text on the bottom
                        if (eccon == "c" || Util.IsEven(count +1)) //par
                        {
@@ -906,6 +915,13 @@ public class EncoderGraphDoPlot
                                Util.TrimDecimals( (sumSaved / countSaved), decimals) + 
                                " " + units;
 
+               //work
+               title += "; " + Catalog.GetString("Work") + ": " + Util.TrimDecimals(workTotal, decimals);
+               if(preferences.encoderWorkKcal)
+                       title += " Cal"; //show total work in cal
+               else
+                       title += " J";
+
                string lossString = "";
 
                //do not show lossString on Preferences.EncoderPhasesEnum.ECC


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]