[chronojump] multissesion graphs done! (nplot -> R done!)



commit 3a169d4d8b06609ec0b5889985f1f29d8d9a0744
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Sep 3 17:19:51 2009 +0200

    multissesion graphs done! (nplot -> R done!)
    disallowed XY and stripchart on multisession
    still needs fine tuning with titles and subtitles for all graphs

 TODO.txt                                   |    1 -
 chronojump_server/bin/chronojumpServer.dll |  Bin 272896 -> 273408 bytes
 src/constants.cs                           |    3 +-
 src/gui/stats.cs                           |  162 +++++++++++++++-------------
 src/stats/main.cs                          |   47 ++++-----
 src/util.cs                                |   10 ++
 6 files changed, 118 insertions(+), 105 deletions(-)
---
diff --git a/TODO.txt b/TODO.txt
index 6f1d17b..8504d86 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,6 +1,5 @@
 TODO: 
 
-do multisession graphs (need to not pass avg or sd columns to graph)
 continue with titles and subtitles for all graphs
 fix global, jumper, rjEvolution
 
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 0ecf759..4f788bd 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/src/constants.cs b/src/constants.cs
index a18676f..5fb3cb9 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -245,7 +245,8 @@ public class Constants
 	public static string [] GraphTypes = { GraphTypeBoxplot, GraphTypeBarplot, GraphTypeLines, 
 		GraphTypeXY, GraphTypeDotchart, GraphTypeStripchart };
 	public static string GraphPaletteGray = "gray.colors";
-	public static string [] GraphPalettes = { GraphPaletteGray, "rainbow", "topo.colors", "heat.colors" };
+	public static string [] GraphPalettes = { GraphPaletteGray, "rainbow", 
+		"topo.colors", "heat.colors", "terrain.colors", "cm.colors" };
 
 
 	public static string FileNameZoomFitIcon = "gtk-zoom-fit.png";
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index c7e6652..7f9da61 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -919,86 +919,86 @@ public class StatsWindow {
 
 		string statisticType = UtilGtk.ComboGetActive(combo_stats_stat_type);
 		string statisticSubType = UtilGtk.ComboGetActive(combo_stats_stat_subtype);
-		if(statisticType == "" || statisticSubType == "") {
-			//for an unknown reason, when we select an option in the combo stats, 
-			//the on_combo_stats_stat_type_changed it's called two times? 
-			//in the first the value of Entry.Text is "";
+			
+		//for an unknown reason, when we select an option in the combo stats, 
+		//the on_combo_stats_stat_type_changed it's called two times? 
+		//in the first the value of Entry.Text is "";
+		if(statisticType == "" || statisticSubType == "") 
 			return;
-		} else {
-			//some stats should not be showed as limited jumps
-			if(statisticType == Constants.TypeJumpsReactive && 
-				       ( statisticSubType == Catalog.GetString("Evolution") ||
-					 statisticSubType == Constants.RJAVGSDRjIndexName ||
-					 statisticSubType == Constants.RJAVGSDQIndexName)
-					 ) {
-				//don't allow Evolution be multisession
-				radiobutton_current_session.Active = true;
-				radiobutton_selected_sessions.Sensitive = false;
-				//has no sense to study the AVG of rj tv tc evolution string
-				//nota fair to make avg of each subjump, 
-				//specially when some RJs have more jumps than others
-				if(radiobutton_stats_jumps_person_average.Active) {
-					radiobutton_stats_jumps_person_bests.Active = true;
-				}
-				radiobutton_stats_jumps_person_average.Sensitive = false;
+			
+		//some stats should not be showed as limited jumps
+		if(statisticType == Constants.TypeJumpsReactive && 
+				( statisticSubType == Catalog.GetString("Evolution") ||
+				  statisticSubType == Constants.RJAVGSDRjIndexName ||
+				  statisticSubType == Constants.RJAVGSDQIndexName)
+		  ) {
+			//don't allow Evolution be multisession
+			radiobutton_current_session.Active = true;
+			radiobutton_selected_sessions.Sensitive = false;
+			//has no sense to study the AVG of rj tv tc evolution string
+			//nota fair to make avg of each subjump, 
+			//specially when some RJs have more jumps than others
+			if(radiobutton_stats_jumps_person_average.Active) {
+				radiobutton_stats_jumps_person_bests.Active = true;
 			}
-			//in Potency formulas show only "all jumps" radiobutton
-			else if(statisticType == Constants.TypeJumpsSimple && ( 
-						statisticSubType == Constants.PotencyLewisFormula ||
-						statisticSubType == Constants.PotencyHarmanFormula ||
-						statisticSubType == Constants.PotencySayersSJFormula ||
-						statisticSubType == Constants.PotencySayersCMJFormula ||
-						statisticSubType == Constants.PotencyShettyFormula ||
-						statisticSubType == Constants.PotencyCanavanFormula ||
-						//statisticSubType == Constants.PotencyBahamondeFormula ||
-						statisticSubType == Constants.PotencyLaraMaleApplicantsSCFormula ||
-						statisticSubType == Constants.PotencyLaraFemaleEliteVoleiFormula ||
-						statisticSubType == Constants.PotencyLaraFemaleMediumVoleiFormula ||
-						statisticSubType == Constants.PotencyLaraFemaleSCStudentsFormula ||
-						statisticSubType == Constants.PotencyLaraFemaleSedentaryFormula
-						) ) {
-				//change the radiobutton value
-				if(radiobutton_stats_jumps_limit.Active || radiobutton_stats_jumps_person_average.Active ||
-						radiobutton_stats_jumps_person_bests.Active) {
-					radiobutton_stats_jumps_all.Active = true;
-				}
-				radiobutton_stats_jumps_all.Sensitive = true;
-				//make no sensitive
-				radiobutton_stats_jumps_limit.Sensitive = false;
-				radiobutton_stats_jumps_person_bests.Sensitive = false;
-				radiobutton_stats_jumps_person_average.Sensitive = false;
+			radiobutton_stats_jumps_person_average.Sensitive = false;
+		}
+		//in Potency formulas show only "all jumps" radiobutton
+		else if(statisticType == Constants.TypeJumpsSimple && ( 
+					statisticSubType == Constants.PotencyLewisFormula ||
+					statisticSubType == Constants.PotencyHarmanFormula ||
+					statisticSubType == Constants.PotencySayersSJFormula ||
+					statisticSubType == Constants.PotencySayersCMJFormula ||
+					statisticSubType == Constants.PotencyShettyFormula ||
+					statisticSubType == Constants.PotencyCanavanFormula ||
+					//statisticSubType == Constants.PotencyBahamondeFormula ||
+					statisticSubType == Constants.PotencyLaraMaleApplicantsSCFormula ||
+					statisticSubType == Constants.PotencyLaraFemaleEliteVoleiFormula ||
+					statisticSubType == Constants.PotencyLaraFemaleMediumVoleiFormula ||
+					statisticSubType == Constants.PotencyLaraFemaleSCStudentsFormula ||
+					statisticSubType == Constants.PotencyLaraFemaleSedentaryFormula
+					) ) {
+			//change the radiobutton value
+			if(radiobutton_stats_jumps_limit.Active || radiobutton_stats_jumps_person_average.Active ||
+					radiobutton_stats_jumps_person_bests.Active) {
+				radiobutton_stats_jumps_all.Active = true;
 			}
-			else if(statisticType == Constants.TypeSessionSummary || 
-					statisticType == Constants.TypeJumperSummary || 
-					( statisticType == Constants.TypeJumpsSimple && 
-					 statisticSubType != Catalog.GetString("No indexes") ) ||
-					(selectedSessions.Count > 1 && ! radiobutton_current_session.Active) )
-			{
-				//change the radiobutton value
-				if(radiobutton_stats_jumps_all.Active || radiobutton_stats_jumps_limit.Active) {
-					radiobutton_stats_jumps_person_bests.Active = true;
-					spin_stats_jumps_person_bests.Sensitive = false; //in this jumps only show the '1' best value
-				}
-				radiobutton_stats_jumps_person_bests.Sensitive = true;
-				radiobutton_stats_jumps_person_average.Sensitive = true;
-				//make no sensitive
-				radiobutton_stats_jumps_all.Sensitive = false;
-				radiobutton_stats_jumps_limit.Sensitive = false;
-				spin_stats_jumps_person_bests.Sensitive = false;
-				
-				//Not RJ Evolution (put selected_sessions_radiobutton visible, and person_average)
-				radiobutton_selected_sessions.Sensitive = true;
-				radiobutton_stats_jumps_person_average.Sensitive = true;
-			} else {
-				radiobutton_stats_jumps_all.Sensitive = true;
-				radiobutton_stats_jumps_limit.Sensitive = true;
-				if(radiobutton_stats_jumps_person_bests.Active) {
-					spin_stats_jumps_person_bests.Sensitive = true;
-				}
-				//Not RJ Evolution (put selected_sessions_radiobutton visible, and person_average)
-				radiobutton_selected_sessions.Sensitive = true;
-				radiobutton_stats_jumps_person_average.Sensitive = true;
+			radiobutton_stats_jumps_all.Sensitive = true;
+			//make no sensitive
+			radiobutton_stats_jumps_limit.Sensitive = false;
+			radiobutton_stats_jumps_person_bests.Sensitive = false;
+			radiobutton_stats_jumps_person_average.Sensitive = false;
+		}
+		else if(statisticType == Constants.TypeSessionSummary || 
+				statisticType == Constants.TypeJumperSummary || 
+				( statisticType == Constants.TypeJumpsSimple && 
+				  statisticSubType != Catalog.GetString("No indexes") ) ||
+				(selectedSessions.Count > 1 && ! radiobutton_current_session.Active) )
+		{
+			//change the radiobutton value
+			if(radiobutton_stats_jumps_all.Active || radiobutton_stats_jumps_limit.Active) {
+				radiobutton_stats_jumps_person_bests.Active = true;
+				spin_stats_jumps_person_bests.Sensitive = false; //in this jumps only show the '1' best value
 			}
+			radiobutton_stats_jumps_person_bests.Sensitive = true;
+			radiobutton_stats_jumps_person_average.Sensitive = true;
+			//make no sensitive
+			radiobutton_stats_jumps_all.Sensitive = false;
+			radiobutton_stats_jumps_limit.Sensitive = false;
+			spin_stats_jumps_person_bests.Sensitive = false;
+
+			//Not RJ Evolution (put selected_sessions_radiobutton visible, and person_average)
+			radiobutton_selected_sessions.Sensitive = true;
+			radiobutton_stats_jumps_person_average.Sensitive = true;
+		} else {
+			radiobutton_stats_jumps_all.Sensitive = true;
+			radiobutton_stats_jumps_limit.Sensitive = true;
+			if(radiobutton_stats_jumps_person_bests.Active) {
+				spin_stats_jumps_person_bests.Sensitive = true;
+			}
+			//Not RJ Evolution (put selected_sessions_radiobutton visible, and person_average)
+			radiobutton_selected_sessions.Sensitive = true;
+			radiobutton_stats_jumps_person_average.Sensitive = true;
 		}
 	}
 
@@ -1046,11 +1046,21 @@ public class StatsWindow {
 		{
 			Log.WriteLine("current");
 			button_stats_select_sessions.Sensitive = false;
+
+			//single session can have all graph types
+			combo_graph_type.Active = UtilGtk.ComboUpdate(
+					combo_graph_type, Constants.GraphTypes, UtilGtk.ComboGetActive(combo_graph_type));
 		} 
 		else if (o == (object) radiobutton_selected_sessions ) 
 		{
 			Log.WriteLine("selected");
 			button_stats_select_sessions.Sensitive = true;
+			
+			//multi session cannot have XY and dotchart
+			string [] types = Util.DeleteString(Constants.GraphTypes, Constants.GraphTypeXY);
+			types = Util.DeleteString(types, Constants.GraphTypeDotchart);
+			combo_graph_type.Active = UtilGtk.ComboUpdate(
+					combo_graph_type, types, UtilGtk.ComboGetActive(combo_graph_type));
 		}
 		update_stats_widgets_sensitiveness();
 		fillTreeView_stats(false);
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 4ad48bc..bc24d64 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -879,32 +879,6 @@ public class Stat
 		plot(table(rpois(100,5)), type = "h", col = "red", lwd=10, main="rpois(100,lambda=5)")
 		*/
 
-
-		/*
-	> heights
-	[1] 0.30 0.50 0.55 0.60
-	> jumpTypes
-	[1] "sj"     "Rocket" "ABK"    "Free"  
-	> plot(heights, axes = FALSE)
-	> axis(1, 1:4, jumpTypes)
-	> axis(2)
-	> box()
-	> title(main='my tit', sub='subtit', cex.sub=0.75, font.sub=3, col.sub='red')
-	*/
-
-		/*
-		   joan <- c(.2, .5, .6)
-		   dayron <- c(.25, .65, .65)
-		   pepa <- c(.1, .2, .21)
-		   jumps <- cbind(joan, dayron, pepa)
-		   rownames(jumps) <- c("SJ", "CMJ", "ABK")
-		   barplot(jumps, beside=T, legend=rownames(jumps))
-		   barplot(jumps, beside=T, legend=rownames(jumps), col=heat.colors(3))
-		   barplot(jumps, beside=T, legend=rownames(jumps), col=gray.colors(3))
-  		   barplot(jumps, beside=T, legend=rownames(jumps), col=rainbow(3))
-		   barplot(jumps, beside=T, legend=rownames(jumps), col=topo.colors(3))
-		   */
-
 	private bool hasTwoAxis()
 	{
 		bool left = false;
@@ -932,6 +906,11 @@ public class Stat
 					side == Sides.RIGHT && serie.IsLeftAxis) {
 				continue;
 			}
+
+			//don't plot AVG row on multisession
+Log.WriteLine("\nserie title: " + serie.Title);
+			if(sessions.Count > 1 && serie.Title == Catalog.GetString("AVG"))
+				continue;
 			//on XY only take two vars
 			if(gro.Type == Constants.GraphTypeXY) {
 				Log.WriteLine("groVarX: " + gro.VarX + " groVarY: " + gro.VarY + " tit: " + serie.Title);
@@ -954,8 +933,22 @@ public class Stat
 			string sep = "";
 			int count2=0;
 			foreach(string val in serie.SerieData) {
-				if(! acceptCheckedData(count2++))
+				bool use = true;
+				if(! acceptCheckedData(count2)) 
+					use = false;
+
+				//don't plot AVG col on multisession
+				if(sessions.Count > 1 && count2 == serie.SerieData.Count) 
+					use = false;
+				
+				//don't plot SD col on multisession
+				if(sessions.Count > 1 && count2 +1 == serie.SerieData.Count) 
+					use = false;
+
+				count2++;
+				if(! use)
 					continue;
+
 				if(val == "-")
 					rD += sep + "0";
 				else
diff --git a/src/util.cs b/src/util.cs
index 9825151..8857bcb 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -408,6 +408,16 @@ public class Util
 		return str2;
 	}
 	
+	public static string [] DeleteString(string [] initial, string delete) {
+		string [] final = new String [initial.Length -1];
+		int count = 0;
+		foreach(string str in initial)
+			if(str != delete)
+				final[count++] = str;
+		return final;
+	}
+	
+	
 	//called from jumpRj.Write() and from interval
 	//when we mark that jump should finish by time, chronopic thread is probably capturing data
 	//check if it captured more than date limit, and if it has done, delete last(s) jump(s)



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