[chronojump] Improvements to last commits



commit c43c548e5b0a062828708ab1d17b78e9fe70c6bb
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Feb 11 11:29:18 2022 +0100

    Improvements to last commits

 src/gui/cairo/generic.cs      |  2 +-
 src/gui/cairo/raceAnalyzer.cs | 20 ++++++++++++++------
 src/gui/cairo/xy.cs           |  9 ++++++---
 3 files changed, 21 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/cairo/generic.cs b/src/gui/cairo/generic.cs
index 5ddf3b2c9..767d2b6c2 100644
--- a/src/gui/cairo/generic.cs
+++ b/src/gui/cairo/generic.cs
@@ -168,7 +168,7 @@ public abstract class CairoGeneric
                g.MoveTo(xtemp, topMargin);
                g.LineTo(xtemp, graphHeight - bottomMargin);
 
-               printText(xtemp, graphHeight -(bottomMargin/2), 0, fontH, text, g, alignTypes.CENTER);
+               printText(xtemp, graphHeight -bottomMargin/2, 0, fontH, text, g, alignTypes.CENTER);
                //LogB.Information("pvgl fontH: " + fontH.ToString());
        }
 
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index 83007f275..c601c22bc 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -144,7 +144,11 @@ public class CairoGraphRaceAnalyzer : CairoXY
                                                g.Restore();
                                        }
                                        if(! useListOfDoublesOnY)
+                                       {
+                                               g.MoveTo(graphWidth - outerMargin, outerMargin);
+                                               g.LineTo(outerMargin, outerMargin);
                                                printXAxisTopText();
+                                       }
                                }
                                else //maybe we have not arrived to any segment
                                        paintGridNiceAutoValues (g, minX, absoluteMaxX, minY, absoluteMaxY, 
5, gridTypes.VERTICALLINES, textHeight-3);
@@ -176,15 +180,19 @@ public class CairoGraphRaceAnalyzer : CairoXY
                //doing = false;
        }
 
+       protected override void printYAxisText()
+       {
+               printText(2, Convert.ToInt32(outerMargin/2), 0, textHeight-3, getYAxisLabel(), g, 
alignTypes.LEFT);
+       }
        protected override void printXAxisText()
        {
-               printText(graphWidth - outerMargin, graphHeight -Convert.ToInt32(.25 * outerMargin),
-                               0, textHeight, getXAxisLabel(), g, alignTypes.RIGHT);
+               printText(graphWidth, graphHeight -bottomMargin/2,
+                               0, textHeight-3, getXAxisLabel() + " ", g, alignTypes.RIGHT);
        }
        private void printXAxisTopText()
        {
-               printText(graphWidth - outerMargin, Convert.ToInt32(.5 * outerMargin),
-                               0, textHeight, getAxisLabel(distanceStr, "m"), g, alignTypes.RIGHT);
+               printText(graphWidth, topMargin/2,
+                               0, textHeight-3, getAxisLabel(distanceStr, "m") + "  ", g, alignTypes.RIGHT);
        }
 
        /*
@@ -204,8 +212,8 @@ public class CairoGraphRaceAnalyzer : CairoXY
                g.MoveTo(xtemp, topMargin);
                g.LineTo(xtemp, graphHeight - bottomMargin);
 
-               printText(xtemp, Convert.ToInt32(.8*topMargin), 0, fontH, textTop, g, alignTypes.CENTER);
-               printText(xtemp, graphHeight-(bottomMargin/2), 0, fontH, textBottom, g, alignTypes.CENTER);
+               printText(xtemp, topMargin/2, 0, fontH, textTop, g, alignTypes.CENTER);
+               printText(xtemp, graphHeight- bottomMargin/2, 0, fontH, textBottom, g, alignTypes.CENTER);
                //LogB.Information("pvgl fontH: " + fontH.ToString());
        }
        protected override void writeTitle()
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index e5f78288d..4268b9cec 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -299,13 +299,16 @@ public abstract class CairoXY : CairoGeneric
                g.LineTo(outerMargin, graphHeight - outerMargin);
                g.LineTo(graphWidth - outerMargin, graphHeight - outerMargin);
                g.Stroke ();
-               printText(2, Convert.ToInt32(outerMargin/2), 0, textHeight, getYAxisLabel(), g, 
alignTypes.LEFT);
+               printYAxisText();
                printXAxisText();
                g.Stroke ();
                g.LineWidth = 2;
        }
 
-       //this combined with paintVerticalGridLine is different on RaceAnalyzer
+       protected virtual void printYAxisText()
+       {
+               printText(2, Convert.ToInt32(outerMargin/2), 0, textHeight, getYAxisLabel(), g, 
alignTypes.LEFT);
+       }
        protected virtual void printXAxisText()
        {
                printText(graphWidth - Convert.ToInt32(outerMargin/2), graphHeight - outerMargin, 0, 
textHeight, getXAxisLabel(), g, alignTypes.LEFT);
@@ -315,7 +318,7 @@ public abstract class CairoXY : CairoGeneric
        {
                return getAxisLabel(xVariable, xUnits);
        }
-       private string getYAxisLabel()
+       protected string getYAxisLabel()
        {
                return getAxisLabel(yVariable, yUnits);
        }


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