[chronojump] jumpsRjFatigue with lines, and fixed xpos of other jumps cairo graphs



commit 274c4d282c774d2acddccded3896a6826e1407fc
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Aug 6 14:28:37 2020 +0200

    jumpsRjFatigue with lines, and fixed xpos of other jumps cairo graphs

 src/gui/cairo/jumpsDjOptimalFall.cs   |  2 +-
 src/gui/cairo/jumpsEvolution.cs       |  2 +-
 src/gui/cairo/jumpsRjFatigue.cs       |  2 +-
 src/gui/cairo/jumpsWeightFVProfile.cs |  2 +-
 src/gui/cairo/xy.cs                   | 32 ++++++++++++++++++++++----------
 5 files changed, 26 insertions(+), 14 deletions(-)
---
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index 176cb300..34095b4d 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -80,7 +80,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
                if(coefs.Length == 3)
                        plotPredictedLine(predictedLineTypes.PARABOLE, predictedLineCrossMargins.TOUCH);
 
-               plotRealPoints();
+               plotRealPoints(false);
 
                if(coefs.Length == 3)
                {
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index cb597c49..380ddcaf 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -71,7 +71,7 @@ public class JumpsEvolutionGraph : CairoXY
                paintGridDatetime();
 
                plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.TOUCH);
-               plotRealPoints();
+               plotRealPoints(false);
 
                writeTitle();
 
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index 5391d48d..118dad34 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -70,7 +70,7 @@ public class JumpsRjFatigueGraph : CairoXY
                paintAxisAndGrid(gridTypes.HORIZONTALLINES);
 
                plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.TOUCH);
-               plotRealPoints();
+               plotRealPoints(true);
 
                writeTitle();
 
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index be3fcddf..4593e250 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -152,7 +152,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
                        }
                }
 
-               plotRealPoints();
+               plotRealPoints(false);
 
                writeTitle();
 
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 5324c2ac..74d44dd1 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -359,15 +359,30 @@ public abstract class CairoXY
                g.Stroke ();
        }
 
-       protected void plotRealPoints()
+       protected void plotRealPoints(bool joinByLine)
        {
+               if(joinByLine) //draw line first to not overlap the points
+               {
+                       bool firstDone = false;
+                       foreach(PointF p in point_l)
+                       {
+                               double xgraph = calculatePaintX(p.X);
+                               double ygraph = calculatePaintY(p.Y);
+
+                               if(! firstDone)
+                               {
+                                       g.MoveTo(xgraph, ygraph);
+                                       firstDone = true;
+                               } else
+                                       g.LineTo(xgraph, ygraph);
+                       }
+                       g.Stroke ();
+               }
+
                foreach(PointF p in point_l)
                {
-                       LogB.Information(string.Format("point: {0}", p));
                        double xgraph = calculatePaintX(p.X);
                        double ygraph = calculatePaintY(p.Y);
-                       LogB.Information(string.Format("{0}, {1}", xgraph, ygraph));
-                       g.MoveTo(xgraph+6, ygraph);
                        g.Arc(xgraph, ygraph, 6.0, 0.0, 2.0 * Math.PI); //full circle
                        g.Color = blue;
                        g.FillPreserve();
@@ -379,13 +394,8 @@ public abstract class CairoXY
                        printText(xgraph, graphHeight - Convert.ToInt32(bottomMargin/2), 0, textHeight, 
Util.TrimDecimals(p.X, 2), g, true);
                        printText(Convert.ToInt32(leftMargin/2), ygraph, 0, textHeight, 
Util.TrimDecimals(p.Y, 2), g, true);
                        */
-
-                       LogB.Information(string.Format("xgraph: {0} corresponds to x real point: {1}", xgraph,
-                                               calculateRealX(xgraph)));
-                       LogB.Information(string.Format("ygraph: {0} corresponds to y real point: {1}", ygraph,
-                                               calculateRealY(ygraph)));
                }
-               getMinMaxXDrawable(graphWidth, absoluteMaxX, minX, totalMargins, totalMargins);
+               //getMinMaxXDrawable(graphWidth, absoluteMaxX, minX, totalMargins, totalMargins);
        }
 
        protected void plotPredictedMaxPoint()
@@ -686,6 +696,7 @@ public abstract class CairoXY
                writeCoordinatesOfMouseClick(graphX, graphY, calculateRealX(graphX), calculateRealY(graphY));
        }
 
+       /*
        private void getMinMaxXDrawable(int ancho, double maxValue, double minValue, int rightMargin, int 
leftMargin)
        {
                LogB.Information(string.Format("Real points fitting on graph margins:  {0} , {1}",
@@ -693,6 +704,7 @@ public abstract class CairoXY
                                        calculateRealX(graphWidth - totalMargins)
                                        ));
        }
+       */
 
        protected Cairo.Color colorFromRGB(int red, int green, int blue)
        {


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