[chronojump] cairo axis separated from grid function (to avoid paint axis two times)
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] cairo axis separated from grid function (to avoid paint axis two times)
- Date: Mon, 10 Aug 2020 09:58:30 +0000 (UTC)
commit 590c827e4b931033f3ae0b1318d84942e9e7122f
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Aug 10 11:58:03 2020 +0200
cairo axis separated from grid function (to avoid paint axis two times)
src/gui/cairo/jumpsDjOptimalFall.cs | 3 ++-
src/gui/cairo/jumpsEvolution.cs | 3 ++-
src/gui/cairo/jumpsRjFatigue.cs | 7 +++----
src/gui/cairo/jumpsWeightFVProfile.cs | 3 ++-
src/gui/cairo/xy.cs | 8 +++++---
5 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/cairo/jumpsDjOptimalFall.cs b/src/gui/cairo/jumpsDjOptimalFall.cs
index b6962fd6..c02f1d7c 100644
--- a/src/gui/cairo/jumpsDjOptimalFall.cs
+++ b/src/gui/cairo/jumpsDjOptimalFall.cs
@@ -74,7 +74,8 @@ public class JumpsDjOptimalFallGraph : CairoXY
findPointMaximums(false);
findAbsoluteMaximums();
- paintAxisAndGrid(gridTypes.BOTH, true);
+ paintGrid(gridTypes.BOTH, true);
+ paintAxis();
LogB.Information(string.Format("coef length:{0}", coefs.Length));
if(coefs.Length == 3)
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index bb1e7cd7..b94f88a2 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -67,7 +67,8 @@ public class JumpsEvolutionGraph : CairoXY
findPointMaximums(false);
//findAbsoluteMaximums();
- paintAxisAndGrid(gridTypes.HORIZONTALLINES, true);
+ paintGrid(gridTypes.HORIZONTALLINES, true);
+ paintAxis();
paintGridDatetime();
plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.TOUCH);
diff --git a/src/gui/cairo/jumpsRjFatigue.cs b/src/gui/cairo/jumpsRjFatigue.cs
index 268f5cfc..ae28216c 100644
--- a/src/gui/cairo/jumpsRjFatigue.cs
+++ b/src/gui/cairo/jumpsRjFatigue.cs
@@ -40,8 +40,6 @@ public class JumpsRjFatigueGraph : CairoXY
endGraph();
}
-
- //regular constructor
public JumpsRjFatigueGraph (
List<PointF> point_l, double slope, double intercept,
DrawingArea area, string title, string jumpType, string date)
@@ -67,8 +65,9 @@ public class JumpsRjFatigueGraph : CairoXY
findPointMaximums(false);
//findAbsoluteMaximums();
- paintAxisAndGrid(gridTypes.HORIZONTALLINES, true);
- paintAxisAndGrid(gridTypes.VERTICALLINES, false);
+ paintGrid(gridTypes.HORIZONTALLINES, true);
+ paintGrid(gridTypes.VERTICALLINES, false);
+ paintAxis();
plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.TOUCH);
plotRealPoints(true);
diff --git a/src/gui/cairo/jumpsWeightFVProfile.cs b/src/gui/cairo/jumpsWeightFVProfile.cs
index ea693687..cfe203eb 100644
--- a/src/gui/cairo/jumpsWeightFVProfile.cs
+++ b/src/gui/cairo/jumpsWeightFVProfile.cs
@@ -132,7 +132,8 @@ public class JumpsWeightFVProfileGraph : CairoXY
findPointMaximums(false);
//findAbsoluteMaximums();
- paintAxisAndGrid(gridTypes.BOTH, true);
+ paintGrid(gridTypes.BOTH, true);
+ paintAxis();
if(showFullGraph)
plotPredictedLine(predictedLineTypes.STRAIGHT, predictedLineCrossMargins.CROSS);
diff --git a/src/gui/cairo/xy.cs b/src/gui/cairo/xy.cs
index fa037685..32fd3979 100644
--- a/src/gui/cairo/xy.cs
+++ b/src/gui/cairo/xy.cs
@@ -259,17 +259,19 @@ public abstract class CairoXY
}
}
- protected void paintAxisAndGrid(gridTypes gridType, bool niceAutoValues)
+ //reccomended to 1st paint the grid, then the axis
+ protected void paintGrid(gridTypes gridType, bool niceAutoValues)
{
g.LineWidth = 1; //to allow to be shown the red arrows on jumpsWeightFVProfile
- //1 paint grid
if(niceAutoValues)
paintGridNiceAutoValues (minX, absoluteMaxX, minY, absoluteMaxY, 5, gridType);
else
paintGridInt (minX, absoluteMaxX, minY, absoluteMaxY, 1, gridType);
+ }
- //2 paint axis (to show axis on overlap)
+ protected void paintAxis()
+ {
g.MoveTo(outerMargins, outerMargins);
g.LineTo(outerMargins, graphHeight - outerMargins);
g.LineTo(graphWidth - outerMargins, graphHeight - outerMargins);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]