[chronojump] RaceAnalyzer capture cairo graphs, better display of top meters data
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] RaceAnalyzer capture cairo graphs, better display of top meters data
- Date: Thu, 10 Feb 2022 11:22:09 +0000 (UTC)
commit ca698d8e7053c74e4b4cb3d6d7c7d4f797c6b020
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Feb 10 12:21:45 2022 +0100
RaceAnalyzer capture cairo graphs, better display of top meters data
src/gui/cairo/generic.cs | 3 +++
src/gui/cairo/raceAnalyzer.cs | 17 +++++++++++++----
2 files changed, 16 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/cairo/generic.cs b/src/gui/cairo/generic.cs
index 59ec99c34..5ddf3b2c9 100644
--- a/src/gui/cairo/generic.cs
+++ b/src/gui/cairo/generic.cs
@@ -162,6 +162,9 @@ public abstract class CairoGeneric
//this combined with printXAxisText is different on RaceAnalyzer
protected virtual void paintVerticalGridLine(Cairo.Context g, int xtemp, string text, int fontH)
{
+ if(fontH < 1)
+ fontH = 1;
+
g.MoveTo(xtemp, topMargin);
g.LineTo(xtemp, graphHeight - bottomMargin);
diff --git a/src/gui/cairo/raceAnalyzer.cs b/src/gui/cairo/raceAnalyzer.cs
index 586492388..5d00f08f1 100644
--- a/src/gui/cairo/raceAnalyzer.cs
+++ b/src/gui/cairo/raceAnalyzer.cs
@@ -119,7 +119,7 @@ public class CairoGraphRaceAnalyzer : CairoXY
else {
for(int i = 0 ; i < verticalLinesUs_2l.Count() ; i ++)
{
- string xTextTop =
verticalLinesUs_2l.GetFromFirst(i).ToString() + "m";
+ string xTextTop =
verticalLinesUs_2l.GetFromFirst(i).ToString();
//seconds
string xTextBottom =
Util.TrimDecimals(verticalLinesUs_2l.GetFromSecond(i)/1000000.0, 1).ToString();
@@ -128,13 +128,14 @@ public class CairoGraphRaceAnalyzer : CairoXY
g.Save();
g.SetDash(new double[]{1, 2}, 0);
if(verticalGridSep > 0)
- paintVerticalGridLine(g, Convert.ToInt32(xGraph),
xTextBottom, textHeight);
+ paintVerticalGridLine(g, Convert.ToInt32(xGraph),
xTextBottom, textHeight-3);
else
- paintVerticalGridLineTopBottom (g,
Convert.ToInt32(xGraph), xTextTop, xTextBottom, textHeight);
+ paintVerticalGridLineTopBottom (g,
Convert.ToInt32(xGraph), xTextTop, xTextBottom, textHeight-3);
g.Stroke ();
g.Restore();
}
}
+ printXAxisTopText();
}
paintAxis();
@@ -166,7 +167,12 @@ public class CairoGraphRaceAnalyzer : CairoXY
protected override void printXAxisText()
{
printText(graphWidth - outerMargin, graphHeight -Convert.ToInt32(.25 * outerMargin),
- 0, textHeight, getXAxisLabel(), g, alignTypes.CENTER);
+ 0, textHeight, getXAxisLabel(), g, alignTypes.RIGHT);
+ }
+ private void printXAxisTopText()
+ {
+ printText(graphWidth - outerMargin, Convert.ToInt32(.5 * outerMargin),
+ 0, textHeight, getAxisLabel(distanceStr, "m"), g, alignTypes.RIGHT);
}
/*
@@ -180,6 +186,9 @@ public class CairoGraphRaceAnalyzer : CairoXY
private void paintVerticalGridLineTopBottom (Cairo.Context g, int xtemp, string textTop, string
textBottom, int fontH)
{
+ if(fontH < 1)
+ fontH = 1;
+
g.MoveTo(xtemp, topMargin);
g.LineTo(xtemp, graphHeight - bottomMargin);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]