[chronojump] X adjusts on CairoBarsNHSeries on showing jumps mixed with/without tc



commit 38f74f78bcc3ea20fbbf22eb4711de2e9a076f5b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Apr 25 11:05:47 2022 +0200

    X adjusts on CairoBarsNHSeries on showing jumps mixed with/without tc

 src/gui/cairo/bars.cs | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 2f7e6f31d..eef4c3645 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -1654,6 +1654,7 @@ public class CairoBarsNHSeries : CairoBars
                        double x = leftMargin + sideWidthRatio*barWidth + i*2*barWidth + 
spacesBetweenBarGroups;
                        double adjustX = 0; //this is used on second bar (at right), can be used on first if 
mainAtLeft
 
+                       //secondary bar: eg tc on jumps
                        for(int j = 0; j < barSecondary_ll.Count; j ++)
                        {
                                PointF pS = barSecondary_ll[j][i];
@@ -1699,11 +1700,12 @@ public class CairoBarsNHSeries : CairoBars
                                adjustX += barWidth;
                        }
 
+                       //main bar: eg tv on jumps
                        if(pB.Y > 0)
                        {
                                //if there is no data on previous variables, just put pB in the middle
-                               if(!secondaryHasData)
-                                       adjustX = -barWidth/2;
+                               if(! secondaryHasData)
+                                       adjustX = barWidth/2;
 
                                double y = calculatePaintY(pB.Y);
 
@@ -1736,6 +1738,10 @@ public class CairoBarsNHSeries : CairoBars
                                                printTextInBar(x +adjustX +barWidth/2, graphHeight 
-bottomMargin -10,
                                                                0, textHeight+2, "c", g, true, false);
                                }
+
+                               //to show text centered at bottom correctly
+                               if(! secondaryHasData)
+                                       adjustX = barWidth;
                        }
 
                        //sort result on bars correctly (this could be useful if mainAtLeft changes)


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