[chronojump] fixed: 644427 stats runIntervallic done: stat, graph, report



commit a1e658a848a414d68e51fee87601a92dd8986433
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Mar 13 20:47:49 2011 +0100

    fixed: 644427 stats runIntervallic done: stat, graph, report

 po/POTFILES.in                     |    1 +
 src/Makefile.am                    |    1 +
 src/statType.cs                    |    7 +-
 src/stats/graphs/runIntervallic.cs |  112 ++++++++++++++++++++++++++++++++++++
 src/stats/main.cs                  |    7 +-
 src/stats/runIntervallic.cs        |   20 +++---
 src/util.cs                        |    2 +-
 7 files changed, 132 insertions(+), 18 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 7759c43..bca7f45 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -63,6 +63,7 @@ src/stats/graphs/rjEvolution.cs
 src/stats/graphs/rjIndex.cs
 src/stats/graphs/rjPotencyBosco.cs
 src/stats/graphs/runSimple.cs
+src/stats/graphs/runIntervallic.cs
 src/stats/graphs/sjCmjAbk.cs
 src/stats/graphs/sjCmjAbkPlus.cs
 src/stats/graphs/jumpSimpleSubtraction.cs
diff --git a/src/Makefile.am b/src/Makefile.am
index 692eca9..2bb7c69 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -133,6 +133,7 @@ FILES = \
  	stats/graphs/potency.cs\
 	stats/graphs/rjAVGSD.cs\
  	stats/graphs/runSimple.cs\
+ 	stats/graphs/runIntervallic.cs\
  	stats/graphs/jumpSimpleSubtraction.cs\
 	sqlite/main.cs\
  	sqlite/preferences.cs\
diff --git a/src/statType.cs b/src/statType.cs
index ecb81e2..54d8590 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -383,10 +383,9 @@ public class StatType {
 				return false;
 			}
 		
-			//if(graph) 
-				//myStat = new GraphRunIntervallic (myStatTypeStruct, evolution_mark_consecutives);
-			//else
-			if(!graph) 
+			if(graph) 
+				myStat = new GraphRunIntervallic (myStatTypeStruct, evolution_mark_consecutives);
+			else
 				myStat = new StatRunIntervallic (myStatTypeStruct, 
 						evolution_mark_consecutives, treeview_stats);
 		}
diff --git a/src/stats/graphs/runIntervallic.cs b/src/stats/graphs/runIntervallic.cs
new file mode 100644
index 0000000..aac4669
--- /dev/null
+++ b/src/stats/graphs/runIntervallic.cs
@@ -0,0 +1,112 @@
+/*
+ * This file is part of ChronoJump
+ *
+ * ChronoJump is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *   the Free Software Foundation; either version 2 of the License, or   
+ *    (at your option) any later version.
+ *    
+ * ChronoJump is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
+ *    GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *
+ * Copyright (C) 2004-2009   Xavier de Blas <xaviblas gmail com> 
+ */
+
+using System;
+using System.Data;
+using Gtk;
+using System.Collections; //ArrayList
+using System.Drawing;
+using System.Drawing.Imaging;
+using Mono.Unix;
+
+
+public class GraphRunIntervallic : StatRunIntervallic
+{
+	protected string operation;
+
+
+	//numContinuous passed only for writing correct Enunciate	
+	public GraphRunIntervallic  (StatTypeStruct myStatTypeStruct, int numContinuous)
+	{
+		isRunIntervalEvolution = true;
+
+		completeConstruction (myStatTypeStruct, treeview);
+		this.numContinuous = numContinuous;
+		
+		string sessionString = obtainSessionSqlString(sessions, "runInterval");
+		//we need to know the reactive with more runs for prepare columns
+		//later this value can be changed in stats/main/plotgraphgraphseries because 
+		//there is possible to check the checked stats rows
+		maxRuns = SqliteStat.ObtainMaxNumberOfRuns(sessionString);
+		
+		this.dataColumns = maxRuns + 1;	//for simplesession (speedavg, speed*runs, )
+		
+		//in X axe, we print the number of runs, not the person names
+		//this should be equal to the number of runs
+		//xAxisNames = new ArrayList(0);
+		for(int i=0; i<maxRuns ; i++) {
+			//xAxisNames.Add((i+1).ToString());
+			CurrentGraphData.XAxisNames.Add((i+1).ToString());
+		}
+		
+		if (statsJumpsType == 2) {
+			this.operation = "MAX";
+		} else {
+			this.operation = "AVG";
+		}
+
+		CurrentGraphData.WindowTitle = Catalog.GetString("ChronoJump graph");
+		//title is shown on the graph except it's a report, then title will be on the html
+		if(myStatTypeStruct.ToReport) {
+			CurrentGraphData.GraphTitle = "";
+		} else {
+			//CurrentGraphData.GraphTitle = this.ToString();
+			CurrentGraphData.GraphTitle = "";
+		}
+		
+		
+		CurrentGraphData.LabelLeft = Catalog.GetString("Speed") + "(m/s)";
+		CurrentGraphData.LabelRight = "";
+		CurrentGraphData.LabelBottom = Catalog.GetString("Runs");
+	}
+
+	protected override void printData (string [] statValues) 
+	{
+		/*
+		 * if one day i found the way of plotting different (single plots) i will use it for the numContinuous
+		 */
+		/*
+		if(numContinuous != -1) {
+			int bestPos = findBestContinuous(statValues, numContinuous);
+			if(bestPos != -1) {
+				statValues = markBestContinuous(statValues, numContinuous, bestPos);
+			}
+		}
+		*/
+		
+		GraphSerie serieSpeed = new GraphSerie();
+		serieSpeed.IsLeftAxis = true;
+
+		int i = 0;
+		foreach (string myValue in statValues) 
+		{
+			if(i==0) 
+				serieSpeed.Title = myValue;
+			else if(i >= 2)
+				serieSpeed.SerieData.Add(myValue);
+			//i==1 is the avg speed, is not used
+
+			i++;
+		}
+
+		//add created series to GraphSeries ArrayList
+		GraphSeries.Add(serieSpeed);
+	}
+}
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 06bec7d..29704e4 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -866,6 +866,7 @@ public class Stat
 	protected ArrayList GraphSeries = new ArrayList();
 
 	protected bool isRjEvolution = false; //needed because in RjEvolution graph, series are treaten in a different way
+	protected bool isRunIntervalEvolution = false; //small differences with isRjEvolution
 	int rjEvolutionMaxJumps; //we should care of maxjumps of the checked rjEvolution rows
 
 	
@@ -1173,7 +1174,7 @@ public class Stat
 
 	private string getRLinesString(GraphROptions gro, string fileName, Sides side) {
 		string allData = "";
-		if(isRjEvolution)
+		if(isRjEvolution || isRunIntervalEvolution)
 			allData = convertDataToROnRjEvolution(gro, side);
 		else
 			allData = convertDataToR(gro, side);
@@ -1194,7 +1195,7 @@ public class Stat
 		string naString = ", na.rm = TRUE";
 
 		string xlimString = "c(0,length(colnames(data))+1)";
-		if(isRjEvolution)
+		if(isRjEvolution || isRunIntervalEvolution)
 			xlimString = "c(1," + rjEvolutionMaxJumps + ")";
 	
 		//TC and TF same color on rjEvo	
@@ -1210,7 +1211,7 @@ public class Stat
 			colors="'black'";
 			gro.Palette="gray.colors";
 			changedPalette = true;
-		} else if(isRjEvolution)
+		} else if(isRjEvolution) //runIntervalEvolution doesn't have this because only has one serie
 			colorsConversionString = "for(i in 2:length(colors)) if(i%%2 == 0) colors[i]=colors[i-1]\n";
 
 		string rG = //rGraphString
diff --git a/src/stats/runIntervallic.cs b/src/stats/runIntervallic.cs
index bd1ab86..83c41f1 100644
--- a/src/stats/runIntervallic.cs
+++ b/src/stats/runIntervallic.cs
@@ -67,11 +67,11 @@ public class StatRunIntervallic : Stat
 		if(toReport && maxRuns > 10) {
 			columnsString[2] = Catalog.GetString("Count");
 			for(int i=0; i < maxRuns && i < 10; i++) {
-				columnsString[i+3] = Catalog.GetString("Speed"); //cols: 3, 4, 5, ...
+				columnsString[i+3] = Catalog.GetString("Speed") + (i+1).ToString(); //cols: 3, 4, 5, ...
 			}
 		} else {
 			for(int i=0; i < maxRuns; i++) {
-				columnsString[i+2] = Catalog.GetString("Speed") + (i+1).ToString(); //cols: 3, 4, 5, ...
+				columnsString[i+2] = Catalog.GetString("Speed") + (i+1).ToString(); //cols: 2, 3, 4, ...
 			}
 		}
 		
@@ -155,10 +155,10 @@ public class StatRunIntervallic : Stat
 			}
 			if(allowedRow) {
 				reportString += "<TR>";
-				//in report, if there are more than 5 runs, break the row
-				if(maxRuns > 5) {
-					//show 5 runs in a row (every run has 1 col: time)
-					int countCols = -1; //jumper, count (from -1 to 0)
+				//in report, if there are more than 10 runs, break the row
+				if(maxRuns > 10) {
+					//show 10 runs in a row (every run has 1 col: speed)
+					int countCols = -2; //person, speed, count (from -2 to 0)
 					int countRows = 0;
 					for (int i=0; i < statValues.Length ; i++) 
 					{
@@ -170,16 +170,16 @@ public class StatRunIntervallic : Stat
 						
 						//when countCols is 0, and countRows is 0 we should print the first 'Count'
 						if(countCols == 0 && countRows == 0) {
-							reportString += "<TD>1-5</TD>";
+							reportString += "<TD>1-10</TD>";
 						}
 						
 						//change line
 						if(countCols >= 10) {
-							reportString += "</TR><TR><TD>&nbsp;</TD>";
+							reportString += "</TR><TR><TD>&nbsp;</TD><TD>&nbsp;</TD>";
 							countRows ++;
 							countCols = 0;
-							reportString += "<TD>" + (countRows*5 + 1) + "-" + 
-								(countRows*5 +5) + "</TD>";
+							reportString += "<TD>" + (countRows*10 + 1) + "-" + 
+								(countRows*10 +10) + "</TD>";
 						}
 						reportString += "<TD>" + statValues[i] + "</TD>";
 						countCols ++;
diff --git a/src/util.cs b/src/util.cs
index 2ceb190..f2a469a 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -1281,7 +1281,7 @@ public class Util
 		}
 		//fill the row with 0's equalling largest row
 		for(int j=i; j < maxRuns; j++) {
-			speeds = speeds + ":-:-";
+			speeds = speeds + ":-";
 		}
 		return speeds;
 	}



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