[chronojump] capture graph jumps/runs can differentiate to max values on same height



commit 0ef1d62087eaee19a77e492dd7459933c4425411
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jul 8 10:25:59 2016 +0200

    capture graph jumps/runs can differentiate to max values on same height

 src/gui/eventExecute.cs |   81 +++++++++++++++++++++++++++++++---------------
 1 files changed, 54 insertions(+), 27 deletions(-)
---
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 5373073..20dcaf3 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -938,10 +938,10 @@ public partial class ChronoJumpWindow
                        return;
                
                //paint first the horizontal guides in order to be behind the bars of each jump
-               drawGuideOrAVG(pen_black_90, eventGraph.sessionMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
-               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               drawGuideOrAVG(pen_black_90, eventGraph.sessionMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
                
-               drawGuideOrAVG(pen_magenta, eventGraph.personMAXAtSQLAllSessions, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               drawGuideOrAVG(pen_magenta, eventGraph.personMAXAtSQLAllSessions, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                //if currentPerson has not jumped on this session, 
                // if has jumped on another session, magenta line: personMAXAtSQLAllSessions will be displayed
@@ -950,8 +950,14 @@ public partial class ChronoJumpWindow
                if(eventGraph.jumpsAtSQL.Length == 0)
                        return;
                
-               drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
-               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               //if person max in all sessions == person max this session, this session max will be only at 
left,
+               //overwriting maxAllSesions that will be only at right
+               if(eventGraph.personMAXAtSQLAllSessions == eventGraph.personMAXAtSQL)
+                       drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.LEFT);
+               else
+                       drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+
+               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
 
                //calculate separation between series and bar width
@@ -1132,9 +1138,9 @@ public partial class ChronoJumpWindow
 
                //blue for TF
                        
-               drawGuideOrAVG(pen_black_90, eventGraph.sessionMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
-               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
-               drawGuideOrAVG(pen_magenta, eventGraph.personMAXAtSQLAllSessions, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               drawGuideOrAVG(pen_black_90, eventGraph.sessionMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_magenta, eventGraph.personMAXAtSQLAllSessions, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
                
                //if currentPerson has not run on this session, 
                // if has run on another session, magenta line: personMAXAtSQLAllSessions will be displayed
@@ -1143,8 +1149,14 @@ public partial class ChronoJumpWindow
                if(eventGraph.runsAtSQL.Length == 0)
                        return;
                
-               drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
-               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               //if person max in all sessions == person max this session, this session max will be only at 
left,
+               //overwriting maxAllSesions that will be only at right
+               if(eventGraph.personMAXAtSQLAllSessions == eventGraph.personMAXAtSQL)
+                       drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.LEFT);
+               else
+                       drawGuideOrAVG(pen_yellow, eventGraph.personMAXAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+
+               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                //calculate bar width
                int distanceBetweenCols = 
Convert.ToInt32((ancho-event_execute_rightMargin)*(1+.5)/eventGraph.runsAtSQL.Length) -
@@ -1198,10 +1210,10 @@ public partial class ChronoJumpWindow
                drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
                */
 
-               drawGuideOrAVG(pen_black_90, eventGraph.sessionMINAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
-               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
-               drawGuideOrAVG(pen_yellow, eventGraph.personMINAtSQL, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
-               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue);
+               drawGuideOrAVG(pen_black_90, eventGraph.sessionMINAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_black_discont, eventGraph.sessionAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_yellow, eventGraph.personMINAtSQL, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue, guideWidthEnum.FULL);
+               drawGuideOrAVG(pen_yellow_discont, eventGraph.personAVGAtSQL, alto, ancho, topMargin, 
bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                int x = 0;
                int y = 0;
@@ -1242,15 +1254,15 @@ public partial class ChronoJumpWindow
 
                        if(jumps > 1) {
                                //blue tf average discountinuos line    
-                               drawGuideOrAVG(pen_azul_discont, avgTV, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
+                               drawGuideOrAVG(pen_azul_discont, avgTV, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue, guideWidthEnum.FULL);
 
                                //red tc average discountinuos line     
-                               drawGuideOrAVG(pen_rojo_discont, avgTC, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
+                               drawGuideOrAVG(pen_rojo_discont, avgTC, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue, guideWidthEnum.FULL);
                        }
 
                        //paint reference guide black and green if needed
-                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
-                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
+                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                        
                        //blue tf evolution     
@@ -1451,8 +1463,8 @@ public partial class ChronoJumpWindow
                        */
 
                        //paint reference guide black and green if needed
-                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
-                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
+                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                        string [] myTimesStringFull = timesString.Split(new char[] {'='});
                        int count = 0;
@@ -1606,11 +1618,11 @@ public partial class ChronoJumpWindow
                if(maxValue - minValue > 0) {
 
                        //blue time average discountinuos line  
-                       drawGuideOrAVG(pen_azul_discont, avgTime, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue);
+                       drawGuideOrAVG(pen_azul_discont, avgTime, alto, ancho, topMargin, bottomMargin, 
maxValue, minValue, guideWidthEnum.FULL);
 
                        //paint reference guide black and green if needed
-                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
-                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue);
+                       drawGuideOrAVG(pen_black_discont, eventGraphConfigureWin.BlackGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
+                       drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, 
topMargin, bottomMargin, maxValue, minValue, guideWidthEnum.FULL);
 
                        //blue time evolution   
                        string [] myTimesStringFull = timesString.Split(new char[] {'='});
@@ -1851,15 +1863,30 @@ public partial class ChronoJumpWindow
                event_execute_pixmap.DrawLayout (myPen, ancho -event_execute_rightMargin, 
(int)calculatePaintHeight(myValue, alto, maxValue, minValue, topMargin, bottomMargin) -7, layoutSmall); //-7 
for aligning (is baseline) (font is Courier 7)
        }
 
-               
-       private void drawGuideOrAVG(Gdk.GC myPen, double guideHeight, int alto, int ancho, int topMargin, int 
bottomMargin, double maxValue, double minValue) 
+       enum guideWidthEnum { FULL, LEFT, RIGHT }
+       private void drawGuideOrAVG(Gdk.GC myPen, double guideHeight, int alto, int ancho, int topMargin, int 
bottomMargin, double maxValue, double minValue, guideWidthEnum guideWidth ) 
        {
                if(guideHeight == -1)
                        return; //return if checkbox guide is not checked
                else {
+                       int xLeft;
+                       int xRight;
+                       if(guideWidth == guideWidthEnum.FULL) {
+                               xLeft = 10;
+                               xRight = ancho - event_execute_rightMargin-2;
+                       }
+                       else if(guideWidth == guideWidthEnum.LEFT) {
+                               xLeft = 10;
+                               xRight = Convert.ToInt32((ancho - event_execute_rightMargin-2) / 2);
+                       }
+                       else {  // RIGHT
+                               xLeft = Convert.ToInt32((ancho - event_execute_rightMargin-2) / 2);
+                               xRight = ancho - event_execute_rightMargin-2;
+                       }
+
                        event_execute_pixmap.DrawLine(myPen, 
-                                       10, calculatePaintHeight(guideHeight, alto, maxValue, minValue, 
topMargin, bottomMargin),
-                                       ancho - event_execute_rightMargin-2, 
calculatePaintHeight(guideHeight, alto, maxValue, minValue, topMargin, bottomMargin));
+                                       xLeft, calculatePaintHeight(guideHeight, alto, maxValue, minValue, 
topMargin, bottomMargin),
+                                       xRight, calculatePaintHeight(guideHeight, alto, maxValue, minValue, 
topMargin, bottomMargin));
                        //write textual data
                        layoutSmall.SetMarkup((Math.Round(guideHeight,1)).ToString());
                        event_execute_pixmap.DrawLayout (pen_gris, ancho -event_execute_rightMargin, 
(int)calculatePaintHeight(guideHeight, alto, maxValue, minValue, topMargin, bottomMargin) -7, layoutSmall); 
//-7 for aligning with Courier 7 font baseline


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