[chronojump] graphs improvements



commit ad6bceecdebefe6efb2ff0006c2080b89903865a
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Sep 2 12:43:58 2009 +0200

    graphs improvements
    fixed some stats-graphs with diff name on column (if they are diff then are not detected in graph XY)
    barplot: colors in legend
    xlab and ylab fixed for all graphs
    xy: fixed legend, fixed when two vars are the same, done XY-YX
    deleted "testing" subs
    support for titles
    subttitle support (only done for RjPotencyBosco now)
    hidden global, jumper, rjEvo until they work
    dialogImageTest has more space for image

 TODO.txt                           |    7 +-
 glade/chronojump.glade             |    2 +-
 src/gui/dialogImageTest.cs         |    1 +
 src/gui/stats.cs                   |   10 ++-
 src/report.cs                      |    7 --
 src/statType.cs                    |    3 -
 src/stats/graphs/djIndex.cs        |    4 +-
 src/stats/graphs/djQ.cs            |    6 +-
 src/stats/graphs/fv.cs             |    4 +-
 src/stats/graphs/global.cs         |   10 ++--
 src/stats/graphs/graphData.cs      |    1 +
 src/stats/graphs/ieIub.cs          |    5 +-
 src/stats/graphs/potency.cs        |    2 +-
 src/stats/graphs/rjAVGSD.cs        |    6 +-
 src/stats/graphs/rjIndex.cs        |    6 +-
 src/stats/graphs/rjPotencyBosco.cs |   21 ++++--
 src/stats/graphs/sjCmjAbkPlus.cs   |    2 +-
 src/stats/main.cs                  |  138 +++++++++++++++++++++++++----------
 src/stats/rjIndex.cs               |    4 +-
 src/stats/rjPotencyBosco.cs        |    4 +-
 20 files changed, 153 insertions(+), 90 deletions(-)
---
diff --git a/TODO.txt b/TODO.txt
index b08963f..99eecbf 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,8 +1,9 @@
 TODO: 
 
-bug: when crash it shows to update to a version that is not last
-
-on graphs xy do that same variable cannot be checked. Also ensure XY, YX works
+do multisession graphs
+fix global, jumper, rjEvolution
+continue with titles and subtitles for all graphs
+do report graphs
 
 check all software (for the Util.TrimDecimals change)
 create accept license on uploading
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 93c5877..14fb66c 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -22491,7 +22491,7 @@ Test&lt;/b&gt;</property>
   <property name="gravity">GDK_GRAVITY_NORTH_WEST</property>
   <property name="focus_on_map">True</property>
   <property name="urgency_hint">False</property>
-  <property name="has_separator">True</property>
+  <property name="has_separator">False</property>
   <signal name="delete_event" handler="on_delete_event" last_modification_time="Tue, 09 May 2006 18:32:26 GMT"/>
 
   <child internal-child="vbox">
diff --git a/src/gui/dialogImageTest.cs b/src/gui/dialogImageTest.cs
index 2181d4a..e771fad 100644
--- a/src/gui/dialogImageTest.cs
+++ b/src/gui/dialogImageTest.cs
@@ -63,6 +63,7 @@ public class DialogImageTest
 		gladeXML.Autoconnect(this);
 		
 		dialog_image_test.Title = title;
+		label_name_description.Visible = false;
 
 		//put an icon to window
 		UtilGtk.IconWindow(dialog_image_test);
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index b96f4c4..66a4961 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -114,7 +114,7 @@ public class StatsWindow {
 
 	private static string [] comboStatsTypeOptions = {
 //		Constants.TypeSessionSummary, //deactivated until R is fully implemented
-		Constants.TypeJumperSummary,
+//		Constants.TypeJumperSummary,
 		Constants.TypeJumpsSimple,
 		Constants.TypeJumpsSimpleWithTC,
 		Constants.TypeJumpsReactive,
@@ -128,7 +128,7 @@ public class StatsWindow {
 	private static string [] comboStatsSubTypeReactiveOptions = {
 		Catalog.GetString("Average Index"), 
 		Constants.RJPotencyBoscoFormula,
-		Catalog.GetString("Evolution"),
+//		Catalog.GetString("Evolution"),
 		Constants.RJAVGSDRjIndexName,
 		Constants.RJAVGSDQIndexName
 	};
@@ -590,9 +590,8 @@ public class StatsWindow {
 
 	private bool fillTreeView_stats (bool graph) 
 	{
-		if(blockFillingTreeview) {
+		if(blockFillingTreeview)
 			return false;
-		}
 		
 		Log.WriteLine("----------FILLING treeview stats---------------");
 	
@@ -870,6 +869,9 @@ public class StatsWindow {
 
 	
 	private void update_stats_widgets_sensitiveness() {
+		if(blockFillingTreeview)
+			return;
+
 		//blank statusbar
 		statusbar_stats.Push( 1, "");
 
diff --git a/src/report.cs b/src/report.cs
index fb186ac..403b9fb 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -386,9 +386,6 @@ public class Report : ExportSession
 					weightStatsPercent,
 					arrayListMarkedRows,
 					rj_evolution_mark_consecutives,
-					//"",			//graphType
-					//"",			//graphPalette
-					//false,			//graphTransposed
 					graphROptions,
 					false, 			//graph
 					toReport,
@@ -417,10 +414,6 @@ public class Report : ExportSession
 					weightStatsPercent,
 					arrayListMarkedRows,
 					rj_evolution_mark_consecutives,
-					//TODO: change this
-					//Constants.GraphTypeLines,			//graphType
-					//"rainbow",			//graphPalette
-					//false,			//graphTransposed
 					graphROptions,
 					true, 			//graph
 					toReport,
diff --git a/src/statType.cs b/src/statType.cs
index 0799547..58c0327 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -64,9 +64,6 @@ public class StatTypeStruct
 		this.HeightPreferred = heightPreferred;
 		this.WeightStatsPercent = weightStatsPercent;
 		this.MarkedRows = markedRows;
-		//this.GraphType = graphType;
-		//this.GraphPalette = graphPalette;
-		//this.GraphTransposed = graphTransposed;
 		this.GRO = gRO;
 		this.ToReport = toReport;
 	}
diff --git a/src/stats/graphs/djIndex.cs b/src/stats/graphs/djIndex.cs
index 70e34a9..aac81da 100644
--- a/src/stats/graphs/djIndex.cs
+++ b/src/stats/graphs/djIndex.cs
@@ -60,7 +60,7 @@ public class GraphDjIndex : StatDjIndex
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Constants.DjIndexFormula;
 		}
 		
 		if(sessions.Count == 1) {
@@ -71,7 +71,7 @@ public class GraphDjIndex : StatDjIndex
 			serieTv = new GraphSerie();
 			serieFall = new GraphSerie();
 				
-			serieIndex.Title = Catalog.GetString("Index");
+			serieIndex.Title = Catalog.GetString("Dj Index");
 			serieHeight.Title = Catalog.GetString("Height");
 			serieTc.Title = Catalog.GetString("TC");
 			serieTv.Title = Catalog.GetString("TF");
diff --git a/src/stats/graphs/djQ.cs b/src/stats/graphs/djQ.cs
index 27e6def..507c6f7 100644
--- a/src/stats/graphs/djQ.cs
+++ b/src/stats/graphs/djQ.cs
@@ -60,7 +60,7 @@ public class GraphDjQ : StatDjQ
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Constants.QIndexFormula;
 		}
 		
 		if(sessions.Count == 1) {
@@ -71,13 +71,13 @@ public class GraphDjQ : StatDjQ
 			serieTv = new GraphSerie();
 			serieFall = new GraphSerie();
 				
-			serieIndex.Title = Catalog.GetString("Index *100");
+			serieIndex.Title = Catalog.GetString("Q Index");
 			serieHeight.Title = Catalog.GetString("Height");
 			serieTc.Title = Catalog.GetString("TC");
 			serieTv.Title = Catalog.GetString("TF");
 			serieFall.Title = Catalog.GetString("Fall");
 			
-			serieIndex.IsLeftAxis = false;
+			serieIndex.IsLeftAxis = true;
 			serieHeight.IsLeftAxis = false;
 			serieTc.IsLeftAxis = true;
 			serieTv.IsLeftAxis = true;
diff --git a/src/stats/graphs/fv.cs b/src/stats/graphs/fv.cs
index b09156a..e3ddbfb 100644
--- a/src/stats/graphs/fv.cs
+++ b/src/stats/graphs/fv.cs
@@ -66,7 +66,7 @@ public class GraphFv : StatFv
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Constants.FvIndexFormula;
 		}
 		
 		if(sessions.Count == 1) {
@@ -75,7 +75,7 @@ public class GraphFv : StatFv
 			serieJump1 = new GraphSerie();
 			serieJump2 = new GraphSerie();
 				
-			serieIndex.Title = Catalog.GetString("Index");
+			serieIndex.Title = indexType;
 			serieJump1.Title = jump1 + " (" + Catalog.GetString("height") + ")";
 			serieJump2.Title = jump2 + " (" + Catalog.GetString("height") + ")";
 			
diff --git a/src/stats/graphs/global.cs b/src/stats/graphs/global.cs
index 6a8881b..31f6449 100644
--- a/src/stats/graphs/global.cs
+++ b/src/stats/graphs/global.cs
@@ -68,8 +68,8 @@ public class GraphGlobal : StatGlobal
 			//four series, the four columns
 			serieIndex = new GraphSerie();
 			serieTv = new GraphSerie();
-				
-			serieIndex.Title = Catalog.GetString("Index");
+	
+			serieIndex.Title = Catalog.GetString("Value");
 			if(heightPreferred) {
 				serieTv.Title = Catalog.GetString("Height");
 			} else {
@@ -162,14 +162,14 @@ public class GraphGlobal : StatGlobal
 							myValueBefore.StartsWith("RjIndex") || myValueBefore.StartsWith(Constants.RJPotencyBoscoName) || 
 							myValueBefore == "IE" || myValueBefore == "IUB") {
 						serieIndex.SerieData.Add(myValue);
-						serieTv.SerieData.Add("-");
+						//serieTv.SerieData.Add("-");
 					} else if(myValueBefore.StartsWith("IndexQ") || myValueBefore == "FV") {
 						serieIndex.SerieData.Add( (
 									Convert.ToDouble(myValue) *10).ToString() );
-						serieTv.SerieData.Add("-");
+						//serieTv.SerieData.Add("-");
 					} else {
 						serieTv.SerieData.Add(myValue);
-						serieIndex.SerieData.Add("-");
+						//serieIndex.SerieData.Add("-");
 					}
 				}
 				i++;
diff --git a/src/stats/graphs/graphData.cs b/src/stats/graphs/graphData.cs
index fa87d38..e094ee0 100644
--- a/src/stats/graphs/graphData.cs
+++ b/src/stats/graphs/graphData.cs
@@ -26,6 +26,7 @@ public class GraphData
 {
 	public string WindowTitle;
 	public string GraphTitle;
+	public string GraphSubTitle;
 	//public string GraphType;
 	//public string GraphPalette;
 	//public bool GraphTransposed;
diff --git a/src/stats/graphs/ieIub.cs b/src/stats/graphs/ieIub.cs
index 1860916..37c2bd1 100644
--- a/src/stats/graphs/ieIub.cs
+++ b/src/stats/graphs/ieIub.cs
@@ -73,7 +73,10 @@ public class GraphIeIub : StatIeIub
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			if(indexType == "IE")
+				CurrentGraphData.GraphTitle = Constants.IeIndexFormula;
+			else
+				CurrentGraphData.GraphTitle = Constants.IubIndexFormula;
 		}
 		
 		
diff --git a/src/stats/graphs/potency.cs b/src/stats/graphs/potency.cs
index b7d73b0..5d04bdc 100644
--- a/src/stats/graphs/potency.cs
+++ b/src/stats/graphs/potency.cs
@@ -63,7 +63,7 @@ public class GraphPotency : StatPotency
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Catalog.GetString("Peak Power");
 		}
 		
 		if(sessions.Count == 1) {
diff --git a/src/stats/graphs/rjAVGSD.cs b/src/stats/graphs/rjAVGSD.cs
index 0cd429b..7ec4db0 100644
--- a/src/stats/graphs/rjAVGSD.cs
+++ b/src/stats/graphs/rjAVGSD.cs
@@ -63,7 +63,7 @@ public class GraphRjAVGSD : StatRjAVGSD
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = indexType;
 		}
 
 
@@ -71,8 +71,8 @@ public class GraphRjAVGSD : StatRjAVGSD
 		serieSD = new GraphSerie();
 		serieJumps = new GraphSerie();
 
-		serieAVG.Title = Catalog.GetString("Index") + " " + Catalog.GetString("Average");
-		serieSD.Title = Catalog.GetString("Index") + " " + Catalog.GetString("SD");
+		serieAVG.Title = Catalog.GetString("Average");
+		serieSD.Title = Catalog.GetString("SD");
 		serieJumps.Title = Catalog.GetString("Jumps");
 
 		serieAVG.IsLeftAxis = true;
diff --git a/src/stats/graphs/rjIndex.cs b/src/stats/graphs/rjIndex.cs
index 26ed06a..68fa6ca 100644
--- a/src/stats/graphs/rjIndex.cs
+++ b/src/stats/graphs/rjIndex.cs
@@ -61,7 +61,7 @@ public class GraphRjIndex : StatRjIndex
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Catalog.GetString("Average Index");
 		}
 		
 		
@@ -73,8 +73,8 @@ public class GraphRjIndex : StatRjIndex
 			serieFall = new GraphSerie();
 				
 			serieIndex.Title = Catalog.GetString("Index");
-			serieTc.Title = Catalog.GetString("TC");
-			serieTv.Title = Catalog.GetString("TF");
+			serieTc.Title = Catalog.GetString("TC") + " (" + Catalog.GetString("AVG") + ")";
+			serieTv.Title = Catalog.GetString("TF") + " (" + Catalog.GetString("AVG") + ")";
 			serieFall.Title = Catalog.GetString("Fall");
 			
 			serieIndex.IsLeftAxis = false;
diff --git a/src/stats/graphs/rjPotencyBosco.cs b/src/stats/graphs/rjPotencyBosco.cs
index 33aad3d..f0d8735 100644
--- a/src/stats/graphs/rjPotencyBosco.cs
+++ b/src/stats/graphs/rjPotencyBosco.cs
@@ -63,7 +63,8 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = Constants.RJPotencyBoscoName;
+			CurrentGraphData.GraphSubTitle = Constants.RJPotencyBoscoFormula;
 		}
 		
 		
@@ -79,8 +80,10 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 			serieIndex.Title = Catalog.GetString("Index");
 			serieTc.Title = Catalog.GetString("TC") + " (" + Catalog.GetString("AVG") + ")";
 			serieTv.Title = Catalog.GetString("TF") + " (" + Catalog.GetString("AVG") + ")";
-			serieJumps.Title = Catalog.GetString("Jumps") + " *10";
-			serieTime.Title = Catalog.GetString("Time") + " *10";
+			//serieJumps.Title = Catalog.GetString("Jumps") + " *10";
+			//serieTime.Title = Catalog.GetString("Time") + " *10";
+			serieJumps.Title = Catalog.GetString("Jumps");
+			serieTime.Title = Catalog.GetString("Time");
 			serieFall.Title = Catalog.GetString("Fall");
 			
 			serieIndex.IsLeftAxis = false;
@@ -168,15 +171,19 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 				} else if(i == 4) {
 					//correct jumps and time for being displayed
 					if(foundAVG)
-						serieJumps.Avg = Convert.ToDouble(myValue) *10;
+						//serieJumps.Avg = Convert.ToDouble(myValue) *10;
+						serieJumps.Avg = Convert.ToDouble(myValue);
 					else
-						serieJumps.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() );
+						//serieJumps.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() );
+						serieJumps.SerieData.Add(myValue);
 				} else if(i == 5) {
 					//correct jumps and time for being displayed
 					if(foundAVG)
-						serieTime.Avg = Convert.ToDouble(myValue) * 10;
+						//serieTime.Avg = Convert.ToDouble(myValue) * 10;
+						serieTime.Avg = Convert.ToDouble(myValue);
 					else
-						serieTime.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() );
+						//serieTime.SerieData.Add( (Convert.ToDouble(myValue) *10).ToString() );
+						serieTime.SerieData.Add(myValue);
 				} else if(i == 6) {
 					if(foundAVG)
 						serieFall.Avg = Convert.ToDouble(myValue);
diff --git a/src/stats/graphs/sjCmjAbkPlus.cs b/src/stats/graphs/sjCmjAbkPlus.cs
index 3aa1a52..57a966d 100644
--- a/src/stats/graphs/sjCmjAbkPlus.cs
+++ b/src/stats/graphs/sjCmjAbkPlus.cs
@@ -59,7 +59,7 @@ public class GraphSjCmjAbkPlus : StatSjCmjAbkPlus
 			CurrentGraphData.GraphTitle = "";
 		} else {
 			//CurrentGraphData.GraphTitle = this.ToString();
-			CurrentGraphData.GraphTitle = "";
+			CurrentGraphData.GraphTitle = "Simple jumps";
 		}
 		
 		if(sessions.Count == 1) {
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 3a5acc8..b6cd297 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -104,6 +104,7 @@ public class Stat
 
 	protected void completeConstruction (StatTypeStruct myStatTypeStruct, Gtk.TreeView treeview)
 	{
+		//TODO: check, this is weird...
 		this.sessions = myStatTypeStruct.SendSelectedSessions;
 		pDN = myStatTypeStruct.PrefsDigitsNumber;
 		this.showSex = myStatTypeStruct.Sex_active;
@@ -1112,6 +1113,7 @@ public class Stat
 		string bD = "data <- cbind("; //bindDataString
 		string colNamesD = "colnames(data) <- c("; //colNamesDataString
 		string sepSerie = "";
+		string xyFirstFound = "";
 		int count = 0; //this counts accepted series
 		foreach(GraphSerie serie in GraphSeries) {
 			if(
@@ -1120,14 +1122,17 @@ public class Stat
 				continue;
 			}
 			//on XY only take two vars
-			Log.WriteLine("groVarX: " + gro.VarX + " groVarY: " + gro.VarY + " tit: " + serie.Title);
-			if(gro.Type == Constants.GraphTypeXY &&
-					(gro.VarX != serie.Title && gro.VarY != serie.Title) ) {
-				Log.WriteLine("break");
-				continue;
+			if(gro.Type == Constants.GraphTypeXY) {
+				Log.WriteLine("groVarX: " + gro.VarX + " groVarY: " + gro.VarY + " tit: " + serie.Title);
+				if(gro.VarX != serie.Title && gro.VarY != serie.Title)
+					continue;
+				else if (xyFirstFound == "") {
+					if(gro.VarX == serie.Title)
+						xyFirstFound = "x";
+					else
+						xyFirstFound = "y";
+				}
 			}
-			else
-				Log.WriteLine("NO break");
 
 
 			rD += "serie" + count.ToString() + " <- c(";
@@ -1144,7 +1149,7 @@ public class Stat
 			}
 			rD += ")\n";
 			bD += sepSerie + "serie" + count.ToString();
-			colNamesD += sepSerie + "'" + serie.Title  + "'";
+			colNamesD += sepSerie + "'" + Util.RemoveTilde(serie.Title)  + "'";
 			sepSerie = ", ";
 			count ++;
 		}
@@ -1157,24 +1162,69 @@ public class Stat
 		for(int i=0; i < CurrentGraphData.XAxisNames.Count; i++) {
 			if(! acceptCheckedData(i))
 				continue;
-			rowNamesD += sep2 + "'" + CurrentGraphData.XAxisNames[i] + "'";
+			rowNamesD += sep2 + "'" + Util.RemoveTilde(CurrentGraphData.XAxisNames[i].ToString()) + "'";
 			sep2 = ", ";
 		}
 		rowNamesD += ")\n";
-		
+			
+		if(gro.Type == Constants.GraphTypeXY) {
+			if(gro.VarX == gro.VarY) {
+				//if it's an XY with only one serie, (both selected vars are the same
+				rD += rD.Replace("serie0", "serie1"); //duplicate rD changing serie name
+				bD = "data <- cbind(serie0, serie1)\n";
+			
+				//have two colNamesD equal to first
+				string [] cn = colNamesD.Split(new char[] {'\''});
+				colNamesD = "colnames(data) <- c('" + cn[1] + "', '" + cn[1] + "')\n";
+			} else if (xyFirstFound == "y") {
+				//if we first found the y value change serie0 to serie1
+				rD = rD.Replace("serie1", "serie2"); 
+				rD = rD.Replace("serie0", "serie1");
+				rD = rD.Replace("serie2", "serie0");
+			}
+		}
+
 		string allData = rD + bD + colNamesD + rowNamesD + "data\n";
-		if(gro.Transposed)
+
+		if(gro.Transposed && gro.Type != Constants.GraphTypeXY)
 			allData += "data <- t(data)\n";
 	
 		return allData;	
 	}
 
+	string getTitle(string graphType) {
+		return "title(main='" + CurrentGraphData.GraphTitle + " (" + graphType +")', sub='" + 
+			CurrentGraphData.GraphSubTitle + "', cex.sub=0.75, font.sub=3, col.sub='grey30')\n";
+	}
+
 	private string getRBarplotString(GraphROptions gro, string fileName, Sides side) {
 		string allData = convertDataToR(gro, side);
+		
+		string ylabStr = "";
+		if(side == Sides.RIGHT) {
+			if(CurrentGraphData.LabelRight != "")
+				ylabStr = ", ylab='" + CurrentGraphData.LabelRight + "'";
+		}
+		else { //ALL or LEFT
+			if(CurrentGraphData.LabelLeft != "")
+				ylabStr = ", ylab='" + CurrentGraphData.LabelLeft + "'";
+		}
+
 		string rG = //rGraphString
-			"barplot(data, beside=T, col=" + gro.Palette + "(length(rownames(data))), las=2)\n" +
-			" legend('" + gro.Legend +"', legend=rownames(data), cex=.7)\n" +
-			"title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
+		   	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
+			"barplot(data, beside=T, col=colors, las=2, xlab=''" + ylabStr + ")\n" +
+			" legend('" + gro.Legend +"', legend=rownames(data), cex=.7, col=colors, pch=3)\n";
+		
+		//have an unique title for both graphs
+		string titStr = getTitle("Barplot");
+		if(hasTwoAxis()) {
+		       if(side==Sides.RIGHT)
+				rG += "par(mfrow=c(1,1), new=TRUE)\n" +
+					"plot(-1, axes=FALSE, type='n', xlab='', ylab='')\n" +
+					titStr + 
+					"par(mfrow=c(1,1), new=FALSE)\n";
+		} else
+			rG += titStr;
 
 		return allData + rG;
 	}
@@ -1182,31 +1232,53 @@ public class Stat
 
 	private string getRLinesString(GraphROptions gro, string fileName, Sides side) {
 		string allData = convertDataToR(gro, side);
-		string axesStr = " axis(2)\n";
-		if(side == Sides.RIGHT)
+		
+		string axesStr = "";
+		string ylabStr = "";
+		if(side == Sides.RIGHT) {
 			axesStr = " axis(4)\n";
+			if(CurrentGraphData.LabelRight != "")
+				ylabStr = ", ylab='" + CurrentGraphData.LabelRight + "'";
+		}
+		else { //ALL or LEFT
+			axesStr = " axis(2)\n";
+			if(CurrentGraphData.LabelLeft != "")
+				ylabStr = ", ylab='" + CurrentGraphData.LabelLeft + "'";
+		}
+
 		string rG = //rGraphString
 		   	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
-		   	" plot(data[1,1:length(colnames(data))], type='b', xlim=c(0,length(colnames(data))+1), ylim=c(min(data),max(data)), pch=1, axes=FALSE, col=colors[1])\n" +
+		   	" plot(data[1,1:length(colnames(data))], type='b', xlim=c(0,length(colnames(data))+1), ylim=c(min(data),max(data)), pch=1, axes=FALSE, col=colors[1], xlab=''" + ylabStr + ")\n" +
 			" if(length(rownames(data))>=2) {\n" +
 			" 	for(i in 2:length(rownames(data)))\n" +
 		   	" 		points(data[i,1:length(colnames(data))], type='b', pch=i, col=colors[i])\n" +
 			" }\n" +
 			" axis(1, 1:length(colnames(data)), colnames(data), las=2)\n" +
 			axesStr + 
-			" legend('" + gro.Legend +"', legend=rownames(data), pch=c(1:length(rownames(data))), cex=.7, col=colors)\n" +
-			" title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
-
+			" legend('" + gro.Legend +"', legend=rownames(data), pch=c(1:length(rownames(data))), cex=.7, col=colors)\n";
+		
+		//have an unique title for both graphs
+		string titStr = getTitle("Lines");
+		if(hasTwoAxis()) {
+		       if(side==Sides.RIGHT)
+				rG += "par(mfrow=c(1,1), new=TRUE)\n" +
+					"plot(-1, axes=FALSE, type='n', xlab='', ylab='')\n" +
+					titStr + 
+					"par(mfrow=c(1,1), new=FALSE)\n";
+		} else
+			rG += titStr;
+		
 		return allData + rG;
 	}
 	
 	private string getRXYString(GraphROptions gro, string fileName) {
 		string allData = convertDataToR(gro, Sides.ALL);
+		string titStr = getTitle("XY");
 		string rG = //rGraphString
 			"rang <- c(1:length(rownames(data)))\n" +
-			"plot(serie0, serie1, pch=rang, col=rang)\n" +
+			"plot(serie0, serie1, pch=rang, col=rang, xlab='" + gro.VarX + "', ylab='" + gro.VarY + "')\n" +
 			"legend('" + gro.Legend +"' ,legend=rownames(data), pch=rang, col=rang, cex=.7)\n" +
-			"title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
+			titStr;
 
 		return allData + rG;
 	}
@@ -1226,17 +1298,14 @@ public class Stat
 			return false;
 		}
 		if (!show) { //report
-			/*
-			string directoryName = Util.GetReportDirectoryName(ileName);
+			string directoryName = Util.GetReportDirectoryName(fileName);
 			string [] pngs = Directory.GetFiles(directoryName, "*.png");
 
 			//if found 3 images, sure will be 1.png, 2.png and 3.png, next will be 4.png
 			//there will be always a png with chronojump_logo
 			fileName = directoryName + "/" + pngs.Length.ToString() + ".png";
-			*/
-		}
-
-		fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName); 
+		} else
+			fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName); 
 	
 		string rString = "png(filename = '" + fileName + "'\n" + 
 			" , width = " + gRO.Width + ", height = " + gRO.Height + ", units = 'px'\n" +
@@ -1270,17 +1339,6 @@ public class Stat
 			rString += getRXYString(gRO, fileName);
 		else //if(CurrentGraphData.GraphType == Constants.GraphTypeDotchart))
 			rString += getRDotchartString(gRO, fileName);
-		//TODO: 
-		//- do XY with two variables (on sjCmjABKPlus select if graph tv or height)
-		//- if is not transposed, then always? legend appears two times and is the same. Plot legend on "MY BIG MAIN TITLE" graph
-
-
-		//have an unique title for both graphs
-		if(hasTwoAxis() && gRO.Type != Constants.GraphTypeXY)
-			rString += "par(mfrow=c(1,1), new=TRUE)\n" +
-				"plot(-1, axes=FALSE)\n" +
-				"title(main='MY BIG MAIN TITLE')\n" +
-				"par(mfrow=c(1,1), new=FALSE)\n";
 		
 		rString += " dev.off()\n";
 
@@ -1299,7 +1357,7 @@ public class Stat
 			if(! File.Exists(fileName) || File.GetLastWriteTime(fileName) < File.GetLastWriteTime(rScript))
 				new DialogMessage(Constants.MessageTypes.WARNING, "Sorry. Error doing graph");
 			else
-				new DialogImageTest("prueba de graph con R", fileName);
+				new DialogImageTest(Catalog.GetString("Chronojump Graph"), fileName);
 		}
 
 		return true;
diff --git a/src/stats/rjIndex.cs b/src/stats/rjIndex.cs
index 155cc45..f07abe4 100644
--- a/src/stats/rjIndex.cs
+++ b/src/stats/rjIndex.cs
@@ -30,8 +30,8 @@ public class StatRjIndex : Stat
 	protected string [] columnsString = { 
 		Catalog.GetString("Jumper"), 
 		Catalog.GetString("Index"), 
-		Catalog.GetString("TF(AVG)"), 
-		Catalog.GetString("TC(AVG)"), 
+		Catalog.GetString("TF") + " (" + Catalog.GetString("AVG") + ")",
+		Catalog.GetString("TC") + " (" + Catalog.GetString("AVG") + ")",
 		Catalog.GetString("Fall") };
 
 	//if this is not present i have problems like (No overload for method `xxx' takes `0' arguments) with some inherited classes
diff --git a/src/stats/rjPotencyBosco.cs b/src/stats/rjPotencyBosco.cs
index cf554bb..f9f07d2 100644
--- a/src/stats/rjPotencyBosco.cs
+++ b/src/stats/rjPotencyBosco.cs
@@ -30,8 +30,8 @@ public class StatRjPotencyBosco : Stat
 	protected string [] columnsString = { 
 		Catalog.GetString("Jumper"), 
 		Catalog.GetString("Index"), 
-		Catalog.GetString("TF(AVG)"), 
-		Catalog.GetString("TC(AVG)"), 
+		Catalog.GetString("TF") + " (" + Catalog.GetString("AVG") + ")",
+		Catalog.GetString("TC") + " (" + Catalog.GetString("AVG") + ")",
 		Catalog.GetString("Jumps"), 
 		Catalog.GetString("Time"), 
 		Catalog.GetString("Fall") };



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