[chronojump] JumpsDjOptimal and FVProfile labels fixed



commit b0dbdab1ddf3c7c53dd6c1fff017b52b4756adbd
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Jan 2 13:50:55 2020 +0100

    JumpsDjOptimal and FVProfile labels fixed

 src/gui/cairo/jumpsDjOptimalFall.cs   | 10 ++++++++++
 src/gui/cairo/jumpsWeightFVProfile.cs |  9 +++++++++
 src/gui/cairo/xy.cs                   | 15 ++++++---------
 3 files changed, 25 insertions(+), 9 deletions(-)
---
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index 87a41b6b..65269bc9 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -59,6 +59,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
                this.title = title;
                this.jumpType = jumpType;
                this.date = date;
+
+               axisRightLabel = "Fall (cm)";
        }
 
        public override void Do()
@@ -93,4 +95,12 @@ public class JumpsDjOptimalFallGraph : CairoXY
                endGraph();
        }
 
+       protected override void writeTitle()
+       {
+               writeTextAtRight(-5, title, true);
+               writeTextAtRight(-4, "Optimal fall height", false);
+               writeTextAtRight(-3, "Jumptype: " + jumpType, false);
+               writeTextAtRight(-2, date, false);
+       }
+
 }
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index d9e637b7..4e46796a 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -61,6 +61,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
                this.title = title;
                this.jumpType = jumpType;
                this.date = date;
+
+               axisRightLabel = "Weight (%)";
        }
 
        public override void Do()
@@ -99,4 +101,11 @@ public class JumpsWeightFVProfileGraph : CairoXY
                endGraph();
        }
 
+       protected override void writeTitle()
+       {
+               writeTextAtRight(-5, title, true);
+               writeTextAtRight(-4, "FV Profile", false);
+               //writeTextAtRight(-3, "Jumptype: " + jumpType, false);
+               writeTextAtRight(-2, date, false);
+       }
 }
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index c62ec711..9ad11ef2 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -26,6 +26,7 @@ using Cairo;
 
 public abstract class CairoXY
 {
+       //used on construction
        protected List<Point> point_l;
        protected double[] coefs;
        protected LeastSquares.ParaboleTypes paraboleType;
@@ -37,6 +38,9 @@ public abstract class CairoXY
        protected string date;
 
        protected Cairo.Context g;
+       protected const int textHeight = 12;
+       protected string axisRightLabel = "";
+
        double minX = 1000000;
        double maxX = 0;
        double minY = 1000000;
@@ -53,7 +57,6 @@ public abstract class CairoXY
        const int outerMargins = 30; //blank space outside the axis
        const int innerMargins = 30; //space between the axis and the real coordinates
        const int totalMargins = outerMargins + innerMargins;
-       protected const int textHeight = 12;
 
        public abstract void Do();
 
@@ -136,7 +139,7 @@ public abstract class CairoXY
                g.LineTo(graphWidth - outerMargins, graphHeight - outerMargins);
                g.Stroke ();
                printText(2, Convert.ToInt32(outerMargins/2), 0, textHeight, "Height (cm)", g, false);
-               printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - outerMargins, 0, 
textHeight, "Fall (cm)", g, false);
+               printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - outerMargins, 0, 
textHeight, axisRightLabel, g, false);
 
                //2 paint grid: horizontal, vertical
                paintGrid (minY, absoluteMaxY, 5, true);
@@ -239,13 +242,7 @@ public abstract class CairoXY
                g.Stroke ();
        }
 
-       protected void writeTitle()
-       {
-               writeTextAtRight(-5, title, true);
-               writeTextAtRight(-4, "Optimal fall height", false);
-               writeTextAtRight(-3, "Jumptype: " + jumpType, false);
-               writeTextAtRight(-2, date, false);
-       }
+       protected abstract void writeTitle();
 
        protected void writeTextPredictedPoint()
        {


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