[chronojump] Cairo graphs can have different widths



commit 2a2ba671c6c57c12ca4a17e7b03b4b539d460df0
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 29 17:07:02 2021 +0200

    Cairo graphs can have different widths

 src/gui/cairo/jumpsDjOptimalFall.cs   |  4 ++--
 src/gui/cairo/jumpsEvolution.cs       |  4 ++--
 src/gui/cairo/jumpsRjFatigue.cs       |  4 ++--
 src/gui/cairo/jumpsWeightFVProfile.cs |  4 ++--
 src/gui/cairo/xy.cs                   | 11 +++++++++--
 5 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index d395ab22..8224ab8b 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -33,7 +33,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
        {
                this.area = area;
 
-               initGraph(font);
+               initGraph(font, .8);
 
                g.SetFontSize(16);
                printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
@@ -75,7 +75,7 @@ public class JumpsDjOptimalFallGraph : CairoXY
        public override void Do(string font)
        {
                LogB.Information("at JumpsDjOptimalFallGraph.Do");
-               initGraph(font);
+               initGraph(font, .8);
 
                 findPointMaximums(false);
                 findAbsoluteMaximums();
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index 751fae10..990fb3e5 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -32,7 +32,7 @@ public class JumpsEvolutionGraph : CairoXY
        {
                this.area = area;
 
-               initGraph(font);
+               initGraph(font, .8);
 
                g.SetFontSize(16);
                printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
@@ -64,7 +64,7 @@ public class JumpsEvolutionGraph : CairoXY
        public override void Do (string font)
        {
                LogB.Information("at JumpsEvolutionGraph.Do");
-               initGraph(font);
+               initGraph(font, .8);
 
                 findPointMaximums(false);
                 //findAbsoluteMaximums();
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index 4e53bc87..cd5b38fc 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -36,7 +36,7 @@ public class JumpsRjFatigueGraph : CairoXY
        {
                this.area = area;
 
-               initGraph(font);
+               initGraph(font, .8);
 
                g.SetFontSize(16);
                //printText(area.Allocation.Width /2, area.Allocation.Height /2, 24, textHeight,
@@ -80,7 +80,7 @@ public class JumpsRjFatigueGraph : CairoXY
        public override void Do(string font)
        {
                LogB.Information("at JumpsRjFatigueGraph.Do");
-               initGraph(font);
+               initGraph(font, .8);
 
                 findPointMaximums(false);
                 //findAbsoluteMaximums();
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index 27eaba9c..b613a750 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -43,7 +43,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
                this.area = area;
                this.errorMessage = errorMessage;
 
-               initGraph(font);
+               initGraph(font, .8);
 
                plotError();
 
@@ -126,7 +126,7 @@ public class JumpsWeightFVProfileGraph : CairoXY
        public override void Do(string font)
        {
                LogB.Information("at JumpsWeightFVProfileGraph.Do");
-               initGraph(font);
+               initGraph(font, .8);
 
                if(showFullGraph)
                        findPointMaximums(true);
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index 6845b76b..5f6a31dd 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -95,15 +95,22 @@ public abstract class CairoXY : CairoGeneric
        protected string speedStr = Catalog.GetString("Speed");
        protected string forceStr = Catalog.GetString("Force");
        protected string dateStr = Catalog.GetString("Date");
+       protected string timeStr = Catalog.GetString("Time");
+       protected string distanceStr = Catalog.GetString("Distance");
        protected string tfStr = Catalog.GetString("TF");
        protected string tcStr = Catalog.GetString("TC");
        protected string countStr = Catalog.GetString("Num");
        protected string jumpTypeStr = Catalog.GetString("Jump type:");
        protected string font;
 
+       public virtual bool PassData (List<PointF> point_l)
+       {
+               return false;
+       }
+
        public abstract void Do(string font);
 
-       protected void initGraph(string font)
+       protected void initGraph(string font, double widthPercent1)
        {
                this.font = font;
                LogB.Information("Font: " + font);
@@ -117,7 +124,7 @@ public abstract class CairoXY : CairoGeneric
                g.SetSourceRGB(1,1,1);
                g.Paint();
 
-               graphWidth = Convert.ToInt32(area.Allocation.Width *.8);
+               graphWidth = Convert.ToInt32(area.Allocation.Width * widthPercent1);
                graphHeight = area.Allocation.Height;
 
                g.SetSourceRGB(0,0,0);


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