[chronojump/michrolab] raceAnalyzer sprint max speed line is drawn according to smoothing



commit 5aa014e3dbcb4af61e38f19eef68d14843d03003
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jul 26 16:56:34 2022 +0200

    raceAnalyzer sprint max speed line is drawn according to smoothing

 src/gui/cairo/raceAnalyzer.cs | 21 +++++++++++++++------
 1 file changed, 15 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index c7021e430..fbace3c4c 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -290,12 +290,21 @@ public class CairoGraphRaceAnalyzer : CairoXY
                        {
                                if(isSprint) //on sprint plot an arrow from top speed (with moving average) 
to the right
                                {
-                                       MovingAverage mAverage = new MovingAverage(points_list, 5);
-                                       mAverage.Calculate();
-                                       PointF pMaxY = mAverage.GetMaxY();
-
-                                       plotArrowPassingRealPoints (g, colorFromRGB(255,0,0),
-                                                       pMaxY.X, pMaxY.Y, points_list[points_list.Count 
-1].X, pMaxY.Y, true, false, 0);
+                                       double graphX = 0;
+                                       double graphY = 0;
+                                       if (smoothLineWindow >= 3)
+                                       {
+                                               MovingAverage mAverage = new MovingAverage (points_list, 
smoothLineWindow);
+                                               mAverage.Calculate ();
+                                               PointF pMaxY = mAverage.GetMaxY ();
+                                               graphX = pMaxY.X;
+                                               graphY = pMaxY.Y;
+                                       } else {
+                                               graphX = xAtMaxY;
+                                               graphY = maxY;
+                                       }
+                                       plotArrowPassingRealPoints (g, colorFromRGB (255,0,0),
+                                                       graphX, graphY, points_list[points_list.Count -1].X, 
graphY, true, false, 0);
                                }
                                else  //if no sprint just plot a circle on max value
                                {


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