[chronojump] fixed? problem on windows netbook when created graphs for report



commit 6ecb55c966a68ef658584317ace6253e357a667e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Sep 7 19:37:02 2009 +0200

    fixed? problem on windows netbook when created graphs for report

 TODO.txt          |    2 ++
 src/report.cs     |   10 ++++++----
 src/statType.cs   |   13 ++++++++++---
 src/stats/main.cs |    6 +++++-
 4 files changed, 23 insertions(+), 8 deletions(-)
---
diff --git a/TODO.txt b/TODO.txt
index 6e466f9..098a008 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,5 +1,7 @@
 TODO: 
 
+do graph margins changeable
+
 continue with titles and subtitles for all graphs
 fix global, jumper, rjEvolution
 
diff --git a/src/report.cs b/src/report.cs
index 52fa59a..d03df67 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -347,8 +347,8 @@ public class Report : ExportSession
 			writer.WriteLine("<h2>Statistics</h2>");
 		
 		//obtain every report stats one by one
-		for(int i=0; i < StatisticsData.Count ; i++) {
-			string [] strFull = StatisticsData[i].ToString().Split(new char[] {'\t'});
+		for(int statCount=0; statCount < StatisticsData.Count ; statCount++) {
+			string [] strFull = StatisticsData[statCount].ToString().Split(new char[] {'\t'});
 			
 			string myHeaderStat = "";
 
@@ -398,7 +398,8 @@ public class Report : ExportSession
 					false, 			//graph
 					toReport,
 					writer,
-					""
+					"",
+					statCount
 					);
 
 			//allFine = myStatType.ChooseStat();
@@ -426,7 +427,8 @@ public class Report : ExportSession
 					true, 			//graph
 					toReport,
 					writer,
-					fileName		//fileName for exporting there
+					fileName,		//fileName for exporting there
+					statCount
 					);
 
 			myStatType.ChooseStat();
diff --git a/src/statType.cs b/src/statType.cs
index c0e7ec9..be7c993 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -87,6 +87,7 @@ public class StatType {
 	bool toReport;
 	TextWriter writer;
 	string fileName;
+	int statCount; //optimal to create name of each graph on report: 1: 1.png; 2: 2.png
 
 	//this contains the last store of a non-graph stat, 
 	//useful for allow to change treeview_stats after a graph stat is done
@@ -181,7 +182,9 @@ public class StatType {
 			ArrayList markedRows, 
 			int rj_evolution_mark_consecutives, 
 			GraphROptions gRO,
-			bool graph, bool toReport, TextWriter writer, string fileName)
+			bool graph, bool toReport, TextWriter writer, string fileName,
+			int statCount 
+			)
 	{
 		this.statisticType = statisticType;
 		this.statisticSubType = statisticSubType;
@@ -204,6 +207,7 @@ public class StatType {
 		this.toReport = toReport;
 		this.writer = writer;
 		this.fileName = fileName;
+		this.statCount = statCount;
 		
 		myStatTypeStruct = new StatTypeStruct (
 				statisticApplyTo,
@@ -404,7 +408,7 @@ public class StatType {
 
 		if(toReport) {
 			if(graph) {
-				bool notEmpty = myStat.CreateGraphR(fileName, false); //dont' show
+				bool notEmpty = myStat.CreateGraphR(fileName, false, statCount); //dont' show
 				if(notEmpty) { linkImage(fileName); }
 			} else {
 				writer.WriteLine(myStat.ReportString());
@@ -412,7 +416,7 @@ public class StatType {
 		} else {
 			if(graph) {
 				//myStat.CreateGraph();
-				myStat.CreateGraphR(Constants.FileNameRGraph, true); //show
+				myStat.CreateGraphR(Constants.FileNameRGraph, true, -1); //show
 			}
 		}
 	
@@ -435,10 +439,13 @@ public class StatType {
 	void linkImage(string fileName) {
 		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
 		writer.WriteLine("<img src=\"" + Util.GetLastPartOfPath(directoryName) + "/" + (pngs.Length -1).ToString() + ".png\">");
+		*/
+		writer.WriteLine("<img src=\"" + Util.GetLastPartOfPath(directoryName) + "/" + (statCount+1).ToString() + ".png\">");
 	}
 
 	public void MarkSelected(string selected) {
diff --git a/src/stats/main.cs b/src/stats/main.cs
index fb22ff4..f524d72 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1165,7 +1165,7 @@ public class Stat
 	public enum Sides { ALL, LEFT, RIGHT };
 
 	//currently only creates one customized graph	
-	public bool CreateGraphR (string fileName, bool show) 
+	public bool CreateGraphR (string fileName, bool show, int graphNum) 
 	{
 		//only graph if there's data
 		//TODO: check also later if none row is selected
@@ -1174,11 +1174,15 @@ public class Stat
 		}
 		if (!show) { //report
 			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 = directoryName+"/"+(graphNum+1).ToString() + ".png";
 		} else
 			fileName = Path.GetTempPath()+"/"+fileName;
 		//On win32 R understands backlash as an escape character and 



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