[chronojump] RaceAnalyzer capture tab, cairo graph max speed shown in raw
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RaceAnalyzer capture tab, cairo graph max speed shown in raw
- Date: Fri, 11 Feb 2022 14:56:22 +0000 (UTC)
commit ab8c074b4fbb3e817316bf8ad45f78ffa8f95bf7
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 11 15:55:59 2022 +0100
RaceAnalyzer capture tab, cairo graph max speed shown in raw
src/gui/cairo/raceAnalyzer.cs | 26 ++++++++++++++++++++------
src/gui/cairo/xy.cs | 4 ++++
2 files changed, 24 insertions(+), 6 deletions(-)
---
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index 73ebcf720..1347c37c9 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -82,6 +82,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
maxX = 0;
minY = 1000000;
maxY = 0;
+ xAtMaxY = 0;
absoluteMaxX = 0;
absoluteMaxY = 0;
@@ -168,19 +169,32 @@ public class CairoGraphRaceAnalyzer : CairoXY
if(plotMaxMark && points_list.Count > 1)
{
- MovingAverage mAverage = new MovingAverage(points_list, 5);
- mAverage.Calculate();
- PointF pMaxY = mAverage.GetMaxY();
-
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);
}
else //if no sprint just plot a circle on max value
{
- double graphX = calculatePaintX(pMaxY.X);
- double graphY = calculatePaintY(pMaxY.Y);
+ double graphX = xAtMaxY;
+ double graphY = maxY;
+ bool useMovingAverage = false;
+ if(useMovingAverage)
+ {
+ MovingAverage mAverage = new MovingAverage(points_list, 5);
+ mAverage.Calculate();
+ PointF pMaxY = mAverage.GetMaxY();
+
+ graphX = pMaxY.X;
+ graphY = pMaxY.Y;
+ }
+ graphX = calculatePaintX (graphX);
+ graphY = calculatePaintY (graphY);
+
g.MoveTo(graphX +8, graphY);
g.Arc(graphX, graphY, 8.0, 0.0, 2.0 * Math.PI); //full circle
g.SetSourceColor(red);
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 4268b9cec..cae7e3abd 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -65,6 +65,7 @@ public abstract class CairoXY : CairoGeneric
protected double maxX = 0;
protected double minY = 1000000;
protected double maxY = 0;
+ protected double xAtMaxY = 0; //raw, used on raceAnalyzer
double yAtMMaxY;
protected double absoluteMaxX;
protected double absoluteMaxY;
@@ -188,7 +189,10 @@ public abstract class CairoXY : CairoGeneric
if(p.Y < minY)
minY = p.Y;
if(p.Y > maxY)
+ {
maxY = p.Y;
+ xAtMaxY = p.X; //used on raceAnalyzer
+ }
}
if (showFullGraph)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]