[chronojump] CairoBars full names under bar (runSimple) and 560 lines of fixes.



commit b31313f0ca95657d79aa630510f8db570a014d4b
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Aug 25 20:25:13 2021 +0200

    CairoBars full names under bar (runSimple) and 560 lines of fixes.

 src/gui/cairo/bars.cs   | 151 ++++++++++++++++++++++++++----------
 src/gui/eventExecute.cs | 201 ++++++++++++++++++++++++++++++++++++++++++++++--
 2 files changed, 304 insertions(+), 48 deletions(-)
---
diff --git a/src/gui/cairo/bars.cs b/src/gui/cairo/bars.cs
index 504f2533c..0ac8e198b 100644
--- a/src/gui/cairo/bars.cs
+++ b/src/gui/cairo/bars.cs
@@ -1,4 +1,3 @@
-
 /*
  * This file is part of ChronoJump
  *
@@ -27,6 +26,8 @@ using Cairo;
 public abstract class CairoBars : CairoGeneric
 {
        protected DrawingArea area;
+       protected int fontHeightForBottomNames;
+       protected int marginForBottomNames;
        protected string title;
        //protected string jumpType;
        //protected string runType;
@@ -54,7 +55,14 @@ public abstract class CairoBars : CairoGeneric
        protected Cairo.Color yellow;
 
 
-       public abstract void Do(string font);
+       public virtual void GraphInit (string font)
+       {
+               textHeight = 14;
+               initGraph(font, 1); //.8 if writeTextAtRight
+       }
+
+       public abstract void GraphDo (List<PointF> pointA_l, List<PointF> pointB_l,
+                       List<string> names_l, int fontHeightForBottomNames, int marginForBottomNames, string 
title);
 
        protected void initGraph(string font, double widthPercent1)
        {
@@ -65,7 +73,9 @@ public abstract class CairoBars : CairoGeneric
                this.font = font;
                LogB.Information("Font: " + font);
 
-               outerMargins = 18; //blank space outside the axis.
+               outerMargins = 18; //blank space outside the axis. //on plotBars is used only for X
+               topMargin = 12;
+               bottomMargin = 9;
 
                //1 create context
                g = Gdk.CairoHelper.Create (area.GdkWindow);
@@ -102,12 +112,12 @@ public abstract class CairoBars : CairoGeneric
        protected void paintAxis(int width)
        {
                g.LineWidth = width;
-               g.MoveTo(outerMargins, outerMargins);
-               g.LineTo(outerMargins, graphHeight - outerMargins);
-               g.LineTo(graphWidth - outerMargins, graphHeight - outerMargins);
+               g.MoveTo(outerMargins, 2*topMargin);
+               g.LineTo(outerMargins, graphHeight - bottomMargin);
+               g.LineTo(graphWidth - outerMargins, graphHeight - bottomMargin);
                g.Stroke ();
 
-               printText(2, Convert.ToInt32(outerMargins/2), 0, textHeight, getYAxisLabel(), g, 
alignTypes.LEFT);
+               printText(2, topMargin, 0, textHeight, getYAxisLabel(), g, alignTypes.LEFT);
                printXAxisText();
                g.Stroke ();
 
@@ -117,7 +127,7 @@ public abstract class CairoBars : CairoGeneric
        //this combined with paintVerticalGridLine is different on RaceAnalyzer
        protected virtual void printXAxisText()
        {
-               printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - outerMargins, 0, 
textHeight,
+               printText(graphWidth - Convert.ToInt32(outerMargins/2), graphHeight - 2*bottomMargin, 0, 
textHeight,
                                getXAxisLabel(), g, alignTypes.LEFT);
        }
 
@@ -145,16 +155,18 @@ public abstract class CairoBars : CairoGeneric
         }
        protected override double calculatePaintY (double realY)
        {
-                return graphHeight - outerMargins - UtilAll.DivideSafe(
-                               (realY - minY) * (graphHeight - 2*outerMargins),
+                return graphHeight - (topMargin + bottomMargin) - UtilAll.DivideSafe(
+                               (realY - minY) * (graphHeight - 2*(topMargin + bottomMargin)),
                                //maxY - minY);
                                //have 10% extra margin on the top (highest values will be 10% far from max 
of the graph)
                                1.1*maxY - minY);
         }
 
-       protected void printText (double x, double y, double height, int textHeight,
+       protected void printText (double x, double y, double heightUnused, int textH,
                        string text, Cairo.Context g, alignTypes align)
        {
+               g.SetFontSize(textH);
+
                int moveToLeft = 0;
                if(align == alignTypes.CENTER || align == alignTypes.RIGHT)
                {
@@ -167,8 +179,28 @@ public abstract class CairoBars : CairoGeneric
                                moveToLeft = Convert.ToInt32(te.Width);
                }
 
-               g.MoveTo( x - moveToLeft, ((y+y+height)/2) + textHeight/2 );
+               g.MoveTo(x - moveToLeft, y + textH/2);
                g.ShowText(text);
+
+               //restore text size
+               g.SetFontSize(textHeight);
+       }
+
+       //text could have one or more \n
+       protected void printTextMultiline (double x, double y, double heightUnused, int textH,
+                       string text, Cairo.Context g, alignTypes align)
+       {
+               if(text == "")
+                       return;
+
+               string [] strFull = text.Split(new char[] {'\n'});
+
+               //reversed to ensure last line is in the bottom
+               for (int i = strFull.Length -1; i >= 0; i --)
+               {
+                       printText (x, y, heightUnused, textH, strFull[i], g, align);
+                       y -= 1.1 * textH;
+               }
        }
 
        protected abstract void plotBars ();
@@ -226,6 +258,39 @@ public abstract class CairoBars : CairoGeneric
                return arr[minp];
        }
 
+       public int GetFontForBottomNames (List<Event> events, int longestWordSize)
+       {
+               // 1) set marginBetweenTexts to 1.1 character
+               Cairo.TextExtents te = g.TextExtents("A");
+               double marginBetweenTexts = 1.1 * te.Width;
+
+               // 2) create the longestWord to find its width
+               string longestWord = new string('A', longestWordSize);
+               te = g.TextExtents(longestWord);
+
+               // 3) if longestWord * events.Count does not fit, iterate to find correct font size
+               int optimalFontHeight = textHeight;
+               for(int i = textHeight; events.Count * (te.Width + marginBetweenTexts) > graphWidth && i > 0; 
i --)
+               {
+                       g.SetFontSize(i);
+                       te = g.TextExtents(longestWord);
+                       optimalFontHeight = i;
+               }
+
+               g.SetFontSize(textHeight); //return font to its default value
+               return optimalFontHeight;
+       }
+
+       public int GetBottomMarginForText (int maxRows, int fontHeight)
+       {
+               g.SetFontSize(fontHeight);
+               Cairo.TextExtents te = g.TextExtents("A");
+               //LogB.Information(string.Format("GetBottomMarginForText, maxRows: {0}, fontHeight: {1}, 
result: {2}",
+               //                      maxRows, fontHeight, Convert.ToInt32(1.2 * te.Height * maxRows)));
+
+               return Convert.ToInt32(1.2 * te.Height * maxRows);
+       }
+
        //TODO: at the moment we are not lowering decs, make resultsFontHeight and decs global variables
        protected int getBarsResultFontHeight (double maxWidth)
        {
@@ -369,12 +434,9 @@ public class CairoBars1Series : CairoBars
        }
 
        //regular constructor
-       public CairoBars1Series (List<PointF> point_l, List<string> names_l, DrawingArea area, string title)
+       public CairoBars1Series (DrawingArea area)
        {
-               this.point_l = point_l;
-               this.names_l = names_l;
                this.area = area;
-               this.title = title;
 
                this.colorSerieA = colorFromGdk(Config.ColorBackground); //but note if we are using system 
colors, this will not match
        }
@@ -410,26 +472,34 @@ public class CairoBars1Series : CairoBars
                        double x = (graphWidth - 2*outerMargins) * (p.X-.5)/point_l.Count - barDesplLeft + 
outerMargins;
                        double y = calculatePaintY(p.Y);
 
-                       drawRoundedRectangle (true, x, y, barWidth, graphHeight -y -outerMargins, 4, g, 
colorSerieA);
-                       plotResultOnBar(x + barWidth/2, y, graphHeight -outerMargins, p.Y, resultFontHeight, 
barWidth, -1);
+                       drawRoundedRectangle (true, x, y, barWidth, graphHeight -y -bottomMargin, 4, g, 
colorSerieA);
+                       plotResultOnBar(x + barWidth/2, y, graphHeight -bottomMargin, p.Y, resultFontHeight, 
barWidth, -1);
 
                        //print the type at bottom
-                       printText(x + barWidth/2, graphHeight -outerMargins + textHeight/2, 0, textHeight,
+                       //printTextMultiline (x + barWidth/2, graphHeight -bottomMargin + 
fontHeightForBottomNames/2, 0, fontHeightForBottomNames,
+                       printTextMultiline (x + barWidth/2, graphHeight - fontHeightForBottomNames * 2/3, 0, 
fontHeightForBottomNames,
                                        names_l[i], g, alignTypes.CENTER);
+                       LogB.Information("names_l[i]: " + names_l[i]);
                }
        }
 
-       public override void Do(string font)
+       public override void GraphDo (List<PointF> pointA_l, List<PointF> pointB_l,
+                       List<string> names_l, int fontHeightForBottomNames, int marginForBottomNames, string 
title)
        {
                LogB.Information("at CairoBars1Series.Do");
+               this.point_l = pointA_l;
+               //this.pointB_l = pointB_l; unused here
+               this.names_l = names_l;
+               this.fontHeightForBottomNames = fontHeightForBottomNames;
+               this.marginForBottomNames = marginForBottomNames;
+               this.title = title;
 
-               textHeight = 14;
-
-               initGraph(font, 1); //.8 if writeTextAtRight
+               LogB.Information(string.Format("bottomMargin pre: {0}, marginForBottomNames: {1}", 
bottomMargin, marginForBottomNames));
+               bottomMargin += marginForBottomNames;
 
                 findPointMaximums();
 
-               g.SetFontSize(textHeight -2);
+               g.SetFontSize(textHeight);// -2);
                paintAxis(2);
                paintGrid(gridTypes.HORIZONTALLINES, true);
                g.SetFontSize(textHeight);
@@ -465,13 +535,9 @@ public class CairoBars2HSeries : CairoBars
        }
 
        //regular constructor
-       public CairoBars2HSeries (List<PointF> pointA_l, List<PointF> pointB_l, List<string> names_l, 
DrawingArea area, string title)
+       public CairoBars2HSeries (DrawingArea area)
        {
-               this.pointA_l = pointA_l;
-               this.pointB_l = pointB_l;
-               this.names_l = names_l;
                this.area = area;
-               this.title = title;
 
                colorSerieA = colorFromGdk(UtilGtk.GetColorShifted(Config.ColorBackground,
                                        ! UtilGtk.ColorIsDark(Config.ColorBackground)));
@@ -524,7 +590,7 @@ public class CairoBars2HSeries : CairoBars
                                double x = (graphWidth - 2*outerMargins) * pA.X/maxX - barDesplLeft + adjustX 
+ outerMargins;
                                double y = calculatePaintY(pA.Y);
 
-                               drawRoundedRectangle (true, x, y, barWidth, graphHeight -y -outerMargins, 4, 
g, colorSerieA);
+                               drawRoundedRectangle (true, x, y, barWidth, graphHeight -y 
-(topMargin+bottomMargin), 4, g, colorSerieA);
                                resultOnBarA_l.Add(new Point3F(x + barWidth/2, y, pA.Y));
                        }
                        else
@@ -539,14 +605,15 @@ public class CairoBars2HSeries : CairoBars
                                double x = (graphWidth - 2*outerMargins) * pB.X/maxX - barDesplLeft + adjustX 
+ outerMargins;
                                double y = calculatePaintY(pB.Y);
 
-                               drawRoundedRectangle (true, x, y, barWidth, graphHeight -y - outerMargins, 4, 
g, colorSerieB);
+                               drawRoundedRectangle (true, x, y, barWidth, graphHeight -y - 
(topMargin+bottomMargin), 4, g, colorSerieB);
                                resultOnBarB_l.Add(new Point3F(x + barWidth/2, y, pB.Y));
                        }
                        else
                                resultOnBarB_l.Add(new Point3F(0, 0, 0));
 
+                       //print text at bottom
                        printText( (graphWidth - 2*outerMargins) * pA.X/maxX + -barDesplLeft + outerMargins,
-                                       graphHeight -outerMargins + textHeight/2, 0, textHeight,
+                                       graphHeight -(topMargin+bottomMargin) + textHeight/2, 0, textHeight,
                                        names_l[i], g, alignTypes.CENTER);
                }
 
@@ -558,25 +625,29 @@ public class CairoBars2HSeries : CairoBars
 
                        if(resultOnBarA_l[i].Y > 0)
                                pAyStart = plotResultOnBar(resultOnBarA_l[i].X, resultOnBarA_l[i].Y,
-                                               graphHeight -outerMargins, resultOnBarA_l[i].Z, 
resultFontHeight, barWidth, -1);
+                                               graphHeight -bottomMargin, resultOnBarA_l[i].Z, 
resultFontHeight, barWidth, -1);
 
                        if(resultOnBarB_l[i].Y > 0)
                                plotResultOnBar(resultOnBarB_l[i].X, resultOnBarB_l[i].Y,
-                                               graphHeight -outerMargins, resultOnBarB_l[i].Z, 
resultFontHeight, barWidth, pAyStart);
+                                               graphHeight -bottomMargin, resultOnBarB_l[i].Z, 
resultFontHeight, barWidth, pAyStart);
                }
        }
 
-       public override void Do(string font)
+       public override void GraphDo (List<PointF> pointA_l, List<PointF> pointB_l,
+                       List<string> names_l, int fontHeightForBottomNames, int marginForBottomNames, string 
title)
        {
-               LogB.Information("at CairoBars2HSeries.Do");
-
-               textHeight = 14;
+               LogB.Information("at CairoBars2HSeries.GraphDo");
+               this.pointA_l = pointA_l;
+               this.pointB_l = pointB_l;
+               this.names_l = names_l;
+               this.fontHeightForBottomNames = fontHeightForBottomNames;
+               this.marginForBottomNames = marginForBottomNames;
+               this.title = title;
 
-               initGraph(font, 1); //.8 if writeTextAtRight
+               bottomMargin += marginForBottomNames;
 
                 findPointMaximums();
 
-               g.SetFontSize(textHeight -2);
                paintAxis(2);
                paintGrid(gridTypes.HORIZONTALLINES, true);
                g.SetFontSize(textHeight);
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 501a6c919..5b684e5ca 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -726,6 +726,7 @@ public partial class ChronoJumpWindow
                event_execute_drawingarea.QueueDraw();
 
                // B) Paint cairo graph
+               cairoPaintBarsPre.ShowPersonNames = radio_contacts_graph_allPersons.Active;
                cairoPaintBarsPre.UseHeights = useHeights;
                cairoPaintBarsPre.Paint();
        }
@@ -911,6 +912,8 @@ public partial class ChronoJumpWindow
                event_execute_drawingarea.QueueDraw();
 
                // B) Paint cairo graph
+               cairoPaintBarsPre.ShowPersonNames = radio_contacts_graph_allPersons.Active;
+               cairoPaintBarsPre.RunsShowTime = check_run_simple_show_time.Active;
                cairoPaintBarsPre.Paint();
        }
        
@@ -1465,20 +1468,27 @@ public partial class ChronoJumpWindow
                return lHeight * maxRows;
        }
 
+       //TODO: need to add personName here
        private int findLongestWordSize (List<Event> events, bool allTypes)
        {
                int longestWordSize = 0;
 
+string longestWord = "";
                foreach(Event ev in events)
                {
                        string [] textArray = ev.Description.Split(new char[] {' '});
                        foreach(string text in textArray)
                        {
                                if(text.Length > longestWordSize)
+                               {
                                        longestWordSize = text.Length;
+longestWord = text;
+                               }
                        }
-
                        //note jump type will be in one line
+                       //if(ev.Description.Length > longestWordSize)
+                       //              longestWordSize = ev.Description.Length;
+
                        //TODO: check it in local user language (Catalog)
                        if(allTypes && ev.Type.Length > longestWordSize)
                                longestWordSize = ev.Type.Length;
@@ -1486,6 +1496,7 @@ public partial class ChronoJumpWindow
                        if(ev.Simulated == -1 && event_execute_label_simulated.Length > longestWordSize)
                                longestWordSize = event_execute_label_simulated.Length;
                }
+LogB.Information("longestWord: " + longestWord);
 
                return longestWordSize;
        }
@@ -3144,12 +3155,15 @@ public partial class ChronoJumpWindow
 //to prepare data before calling cairo method
 public abstract class CairoPaintBarsPre
 {
+       public bool ShowPersonNames; //to hide desc if not ShowPersonNames (because in ShowPersonNames, desc 
is name, but we do not want to see a comment there)
+
        //jump simple
        public PrepareEventGraphJumpSimple eventGraphJumpsStored;
        public bool UseHeights;
 
        //run simple
        public PrepareEventGraphRunSimple eventGraphRunsStored;
+       public bool RunsShowTime;
 
        protected DrawingArea darea;
        protected string fontStr;
@@ -3210,6 +3224,137 @@ public abstract class CairoPaintBarsPre
        protected abstract bool storeCreated ();
        protected abstract bool haveDataToPlot ();
        protected abstract void paintSpecific();
+
+       //TODO: this is repeated on this file, think also if move it to gui/cairo/bars.cs
+       protected int calculateMaxRowsForText (List<Event> events, int longestWordSize, bool allJumps, bool 
runsPrintTime)
+       {
+               int maxRows = 0;
+
+LogB.Information("calculateMaxRowsForText");
+               foreach(Event ev in events)
+               {
+LogB.Information("Event: " + ev.ToString());
+                       int rows = 0;
+                       if(allJumps)                    //to write the jump type (1st the jump type because 
it's only one row)
+                               rows ++;
+
+                       //try to pack small words if they fit in a row using wordsAccu (accumulated)
+                       string wordsAccu = "";
+                       string [] words = ev.Description.Split(new char[] {' '});
+
+                       foreach(string word in words)
+                       {
+                               if(wordsAccu == "")
+                                       wordsAccu = word;
+                               else if( (wordsAccu + " " + word).Length <= longestWordSize )
+                                       wordsAccu += " " + word;
+                               else {
+                                       wordsAccu = word;
+                                       rows ++;
+                               }
+                       }
+                       if(wordsAccu != "")
+                               rows ++;
+
+                       if(ev.Simulated == -1) //to write simulated at bottom
+                               rows ++;
+
+                       if(runsPrintTime)
+                               rows ++;
+
+                       if(rows > maxRows)
+                               maxRows = rows;
+               }
+
+               return maxRows;
+       }
+
+       //TODO: need to add personName here
+       protected int findLongestWordSize (List<Event> events, bool allTypes, string simulatedLabel)
+       {
+               int longestWordSize = 0;
+
+               foreach(Event ev in events)
+               {
+                       string [] textArray = ev.Description.Split(new char[] {' '});
+                       foreach(string text in textArray)
+                       {
+                               if(text.Length > longestWordSize)
+                                       longestWordSize = text.Length;
+                       }
+
+                       //note jump type will be in one line
+                       //TODO: check it in local user language (Catalog)
+                       if(allTypes && ev.Type.Length > longestWordSize)
+                               longestWordSize = ev.Type.Length;
+
+                       if(ev.Simulated == -1 && simulatedLabel.Length > longestWordSize)
+                               longestWordSize = simulatedLabel.Length;
+               }
+
+               return longestWordSize;
+       }
+
+       //person name or test type, or both
+       //this can separate name with spaces on rows
+       //TODO: rows maybe are not needed, depending if cairoBars takes correctly the \n
+       protected string createTextBelowBar(
+                       string secondResult,    //time on runSimple
+                       string jumpType,
+                       string personName,
+                       bool simulated,
+                       int longestWordSize, int maxRowsForText)
+       {
+               string str = "";
+               string vertSep = "";
+               int row = 1;
+
+               if(secondResult != "")
+               {
+                       str += vertSep + secondResult;
+                       vertSep = "\n";
+                       row ++;
+               }
+
+               //if have to print jump type, print it first in one row
+               if(jumpType != "")
+               {
+                       str += vertSep + jumpType;
+                       vertSep = "\n";
+                       row ++;
+               }
+
+               // 2) separate person name in rows and send it to plotTextBelowBarDoRow()
+               //    packing small words if they fit in a row using wordsAccu (accumulated)
+
+               string wordsAccu = "";
+               string [] words = personName.Split(new char[] {' '});
+
+               foreach(string word in words)
+               {
+                       if(wordsAccu == "")
+                               wordsAccu = word;
+                       else if( (wordsAccu + " " + word).Length <= longestWordSize )
+                               wordsAccu += " " + word;
+                       else {
+                               str += vertSep + wordsAccu;
+                               vertSep = "\n";
+                               wordsAccu = word;
+                               row ++;
+                       }
+               }
+               str += wordsAccu;
+
+               if(simulated)
+               {
+                       //if(str != "" && wordsAccu != "")
+                       //      str += "\n";
+
+                       str += vertSep + "(" + Catalog.GetString("Simulated") + ")"; //TODO: improve this to 
ensure it is last row
+               }
+
+               return str;
+       }
 }
 
 public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
@@ -3277,11 +3422,11 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
 
                CairoBars cbjt;
                if(showBarA && showBarB) //Dja, Djna
-                       cbjt = new CairoBars2HSeries (pointA_l, pointB_l, names_l, darea, title);
+                       cbjt = new CairoBars2HSeries (darea);
                else if (showBarA) //takeOff, takeOffWeight
-                       cbjt = new CairoBars1Series (pointA_l, names_l, darea, title);
+                       cbjt = new CairoBars1Series (darea);
                else //rest of the jumps: sj, cmj, ..
-                       cbjt = new CairoBars1Series (pointB_l, names_l, darea, title);
+                       cbjt = new CairoBars1Series (darea);
 
                if(UseHeights) {
                        cbjt.YVariable = "Height";
@@ -3290,7 +3435,14 @@ public class CairoPaintBarsPreJumpSimple : CairoPaintBarsPre
                        cbjt.YVariable = "Time";
                        cbjt.YUnits = "s";
                }
-               cbjt.Do(fontStr);
+
+               cbjt.GraphInit(fontStr);
+               if(showBarA && showBarB) //Dja, Djna
+                       cbjt.GraphDo (pointA_l, pointB_l, names_l, 14, 0, title);
+               else if (showBarA) //takeOff, takeOffWeight
+                       cbjt.GraphDo (pointA_l, new List<PointF>(), names_l, 14, 0, title);
+               else //rest of the jumps: sj, cmj, ..
+                       cbjt.GraphDo (pointB_l, new List<PointF>(), names_l, 14, 0, title);
        }
 }
 
@@ -3318,6 +3470,23 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
 
        protected override void paintSpecific()
        {
+               CairoBars1Series cbjt = new CairoBars1Series (darea);
+               cbjt.GraphInit(fontStr);
+
+               //TODO: add in parent class?
+               List<Event> events = Run.RunListToEventList(eventGraphRunsStored.runsAtSQL);
+
+               if(! ShowPersonNames)
+                       for(int i=0 ; i < eventGraphRunsStored.runsAtSQL.Count; i++)
+                               eventGraphRunsStored.runsAtSQL[i].Description = ""; //to avoid showing 
description
+
+               int longestWordSize = findLongestWordSize (events, eventGraphRunsStored.type == "", "(" + 
Catalog.GetString("Simulated") + ")"); // condition for "all runs"
+               int fontHeightForBottomNames = cbjt.GetFontForBottomNames (events, longestWordSize);
+               int maxRowsForText = calculateMaxRowsForText (events, longestWordSize, 
eventGraphRunsStored.type == "", RunsShowTime); //also adds +1 if simulated
+               int bottomMargin = cbjt.GetBottomMarginForText (maxRowsForText, fontHeightForBottomNames);
+
+               LogB.Information(string.Format("fontHeightForBottomNames: {0}, bottomMargin: {1}", 
fontHeightForBottomNames, bottomMargin));
+
                List<PointF> point_l = new List<PointF>();
                List<string> names_l = new List<string>();
 
@@ -3325,10 +3494,26 @@ public class CairoPaintBarsPreRunSimple : CairoPaintBarsPre
                foreach(Run run in eventGraphRunsStored.runsAtSQL)
                {
                        point_l.Add(new PointF(countToDraw --, run.Distance/run.Time));
-                       names_l.Add(Catalog.GetString(run.Type));
+
+                       //names_l.Add(Catalog.GetString(run.Type));
+
+                       string typeRowString = "";
+                       if (eventGraphRunsStored.type == "") //if "all runs" show run.Type
+                               typeRowString = run.Type;
+
+                       string timeString = "";
+                       if(RunsShowTime)
+                               //timeString = string.Format("{0} s", Util.TrimDecimals(run.Time, 
preferences.digitsNumber));
+                               timeString = string.Format("{0} s", Util.TrimDecimals(run.Time, 3));
+
+                       names_l.Add(createTextBelowBar(
+                                               timeString,
+                                               typeRowString,
+                                               run.Description,
+                                               (run.Simulated == -1),
+                                               longestWordSize, maxRowsForText));
                }
 
-               CairoBars1Series cbjt = new CairoBars1Series (point_l, names_l, darea, title);
-               cbjt.Do(fontStr);
+               cbjt.GraphDo(point_l, new List<PointF>(), names_l, fontHeightForBottomNames, bottomMargin, 
title);
        }
 }


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