[chronojump] RaceAnalyzer speed/time graph shows arrow from maxY to right (speed decrement)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RaceAnalyzer speed/time graph shows arrow from maxY to right (speed decrement)
- Date: Thu, 12 Aug 2021 15:59:15 +0000 (UTC)
commit 893ff5a5d957d4a95e0190e766342d9e7c3631bd
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Aug 12 17:58:09 2021 +0200
RaceAnalyzer speed/time graph shows arrow from maxY to right (speed decrement)
src/gui/app1/runEncoder.cs | 6 +++---
src/gui/cairo/raceAnalyzer.cs | 14 ++++++++++++--
2 files changed, 15 insertions(+), 5 deletions(-)
---
diff --git a/src/gui/app1/runEncoder.cs b/src/gui/app1/runEncoder.cs
index be9e7a3eb..f349baa26 100644
--- a/src/gui/app1/runEncoder.cs
+++ b/src/gui/app1/runEncoder.cs
@@ -2083,7 +2083,7 @@ public partial class ChronoJumpWindow
if(cairoGraphRaceAnalyzer_dt == null)
cairoGraphRaceAnalyzer_dt = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_position_time, "title",
- Catalog.GetString("Distance"), "m");
+ Catalog.GetString("Distance"), "m", false);
cairoGraphRaceAnalyzer_dt.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_dt_l, forceRedraw,
CairoXY.PlotTypes.POINTSLINES);
@@ -2093,7 +2093,7 @@ public partial class ChronoJumpWindow
if(cairoGraphRaceAnalyzer_st == null)
cairoGraphRaceAnalyzer_st = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_speed_time, "title",
- Catalog.GetString("Speed"), "m/s");
+ Catalog.GetString("Speed"), "m/s", true);
cairoGraphRaceAnalyzer_st.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_st_l, forceRedraw,
CairoXY.PlotTypes.POINTSLINES);
@@ -2106,7 +2106,7 @@ public partial class ChronoJumpWindow
if(cairoGraphRaceAnalyzer_at == null)
cairoGraphRaceAnalyzer_at = new CairoGraphRaceAnalyzer(
drawingarea_race_analyzer_capture_accel_time, "title",
- Catalog.GetString("Accel"), "m/s^2");
+ Catalog.GetString("Accel"), "m/s^2", false);
cairoGraphRaceAnalyzer_at.DoSendingList (preferences.fontType.ToString(),
cairoGraphRaceAnalyzerPoints_at_l, forceRedraw, CairoXY.PlotTypes.LINES);
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index 679c15bb2..63e5514e2 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -28,6 +28,7 @@ using Cairo;
public class CairoGraphRaceAnalyzer : CairoXY
{
int points_list_painted;
+ private bool plotHorizArrowFromMaxY;
/*
//constructor when there are no points
@@ -50,7 +51,8 @@ public class CairoGraphRaceAnalyzer : CairoXY
//regular constructor
public CairoGraphRaceAnalyzer (
DrawingArea area, string title,
- string yVariable, string yUnits)
+ string yVariable, string yUnits,
+ bool plotHorizArrowFromMaxY)
{
this.area = area;
this.title = title;
@@ -60,6 +62,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
this.yVariable = yVariable;
xUnits = "s";
this.yUnits = yUnits;
+ this.plotHorizArrowFromMaxY = plotHorizArrowFromMaxY;
// doing = false;
points_list_painted = 0;
@@ -103,9 +106,16 @@ public class CairoGraphRaceAnalyzer : CairoXY
if( points_list != null &&
(maxValuesChanged || forceRedraw || points_list.Count != points_list_painted)
)
{
-
plotRealPoints(plotType, points_list, points_list_painted);
points_list_painted = points_list.Count;
+
+ if(plotHorizArrowFromMaxY && points_list.Count > 1)
+ {
+ MovingAverage mAverage = new MovingAverage(points_list, 5);
+ mAverage.Calculate();
+ PointF pMaxY = mAverage.GetMaxY();
+ plotArrow (pMaxY.X, pMaxY.Y, points_list[points_list.Count -1].X, pMaxY.Y,
true, 0);
+ }
}
if(initGraphDone)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]