[chronojump] Cairo jumps by years now can show also months if X resolution is high
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Cairo jumps by years now can show also months if X resolution is high
- Date: Mon, 13 Jan 2020 11:14:39 +0000 (UTC)
commit b4ece02589d52b861b6c6b47111288728e174e9e
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon Jan 13 12:14:12 2020 +0100
Cairo jumps by years now can show also months if X resolution is high
src/gui/cairo/jumpsEvolution.cs | 10 ++++++++++
1 file changed, 10 insertions(+)
---
diff --git a/src/gui/cairo/jumpsEvolution.cs b/src/gui/cairo/jumpsEvolution.cs
index 723761ab..b1a17c6a 100644
--- a/src/gui/cairo/jumpsEvolution.cs
+++ b/src/gui/cairo/jumpsEvolution.cs
@@ -93,6 +93,16 @@ public class JumpsEvolutionGraph : CairoXY
g.SetDash(new double[]{1, 2}, 0);
bool paintMonths = (Convert.ToInt32(Math.Floor(maxX)) - Convert.ToInt32(Math.Floor(minX)) <
3); //paint months if few years
+ //or if years are very separated (high X resolution)
+ if(! paintMonths)
+ {
+ int year = Convert.ToInt32(Math.Floor(minX)) -1;
+ int xtemp1 = Convert.ToInt32(calculatePaintX(year, graphWidth, maxX, minX,
outerMargins + innerMargins, outerMargins + innerMargins));
+ int xtemp2 = Convert.ToInt32(calculatePaintX(year + 1, graphWidth, maxX, minX,
outerMargins + innerMargins, outerMargins + innerMargins));
+ if(xtemp2 - xtemp1 > 500)
+ paintMonths = true;
+
+ }
//-1 to start on previous year to see last months (if fit into graph)
for(int year = Convert.ToInt32(Math.Floor(minX)) -1; year <=
Convert.ToInt32(Math.Floor(maxX)); year ++)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]