[chronojump] Graphs have line width



commit 4f92c6e33ceadfb0ad640c0a2e5f2255ff1b1e46
Author: Xavier de Blas <xaviblas master gnome org>
Date:   Fri May 28 17:15:45 2010 +0800

    Graphs have line width

 chronojump_server/bin/chronojumpServer.dll |  Bin 282624 -> 282624 bytes
 glade/chronojump.glade                     |   37 +++++++++++++++++++++++++++-
 src/gui/stats.cs                           |   20 ++++++++++++++-
 src/stats/graphs/graphROptions.cs          |   21 +++++++++-------
 src/stats/main.cs                          |   30 +++++++++++-----------
 5 files changed, 82 insertions(+), 26 deletions(-)
---
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 001553f..8a9916c 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 8b4ccef..126df28 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -4387,6 +4387,41 @@ options</property>
                                       </packing>
                                     </child>
                                     <child>
+                                      <widget class="GtkHBox" id="hbox_line">
+                                        <property name="visible">True</property>
+                                        <child>
+                                          <widget class="GtkLabel" id="label_line">
+                                            <property name="visible">True</property>
+                                            <property name="tooltip" translatable="yes">Width of the line</property>
+                                            <property name="label" translatable="yes">Line</property>
+                                          </widget>
+                                          <packing>
+                                            <property name="position">0</property>
+                                          </packing>
+                                        </child>
+                                        <child>
+                                          <widget class="GtkSpinButton" id="spin_line">
+                                            <property name="visible">True</property>
+                                            <property name="can_focus">True</property>
+                                            <property name="tooltip" translatable="yes">Width of the line</property>
+                                            <property name="invisible_char">&#x25CF;</property>
+                                            <property name="adjustment">1 1 5 1 1 0</property>
+                                            <property name="climb_rate">1</property>
+                                            <property name="snap_to_ticks">True</property>
+                                            <property name="numeric">True</property>
+                                          </widget>
+                                          <packing>
+                                            <property name="expand">False</property>
+                                            <property name="fill">False</property>
+                                            <property name="position">1</property>
+                                          </packing>
+                                        </child>
+                                      </widget>
+                                      <packing>
+                                        <property name="position">1</property>
+                                      </packing>
+                                    </child>
+                                    <child>
                                       <widget class="GtkCheckButton" id="checkbutton_margins">
                                         <property name="label" translatable="yes">Margins</property>
                                         <property name="visible">True</property>
@@ -4400,7 +4435,7 @@ options</property>
                                       <packing>
                                         <property name="expand">False</property>
                                         <property name="fill">False</property>
-                                        <property name="position">1</property>
+                                        <property name="position">2</property>
                                       </packing>
                                     </child>
                                   </widget>
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 7d4763b..9934d6a 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -85,6 +85,9 @@ public class StatsWindow {
 	[Widget] Gtk.ComboBox combo_graph_palette;
 	[Widget] Gtk.Label label_graph_options;
 	[Widget] Gtk.CheckButton checkbutton_transposed;
+	[Widget] Gtk.Box hbox_line;
+	[Widget] Gtk.SpinButton spin_line;
+
 	[Widget] Gtk.Box hbox_combo_graph_width;
 	[Widget] Gtk.Box hbox_combo_graph_height;
 	[Widget] Gtk.ComboBox combo_graph_width;
@@ -423,9 +426,12 @@ public class StatsWindow {
 	}
 	
 	private void showTransposed(bool show) {
-		//label_graph_options.Visible = show;
 		checkbutton_transposed.Visible = show;
 	}
+	
+	private void showLineWidth(bool show) {
+		hbox_line.Visible = show;
+	}
 
 	private void showGraphXYStuff(bool show) {
 		label_graph_var_x.Visible = show;
@@ -439,6 +445,17 @@ public class StatsWindow {
 			showGraphXYStuff(true);
 		else 
 			showGraphXYStuff(false);
+		
+		/*
+		if(
+				UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeHistogram ||
+				UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
+*/
+			showLineWidth(true);
+/*		else
+			showLineWidth(false);
+*/
+
 
 		if(
 				UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeDotchart ||
@@ -673,6 +690,7 @@ public class StatsWindow {
 				UtilGtk.ComboGetActive(combo_graph_var_y),
 				UtilGtk.ComboGetActive(combo_graph_palette),
 				checkbutton_transposed.Active,
+				Convert.ToInt32(spin_line.Value), 
 				Convert.ToInt32(UtilGtk.ComboGetActive(combo_graph_width)),
 				Convert.ToInt32(UtilGtk.ComboGetActive(combo_graph_height)),
 				UtilGtk.ComboGetActive(combo_graph_legend),
diff --git a/src/stats/graphs/graphROptions.cs b/src/stats/graphs/graphROptions.cs
index 11b9ec0..c190100 100644
--- a/src/stats/graphs/graphROptions.cs
+++ b/src/stats/graphs/graphROptions.cs
@@ -31,6 +31,7 @@ public class GraphROptions
 	public string VarY;
 	public string Palette;
 	public bool Transposed;
+	public int LineWidth;
 	public int Width;
 	public int Height;
 	public string Legend;
@@ -40,13 +41,14 @@ public class GraphROptions
 	public int MarginRight;
 	
 	public GraphROptions(string Type, string VarX, string VarY, string Palette, bool Transposed, 
-			int Width, int Height, string Legend,
+			int LineWidth, int Width, int Height, string Legend,
 			int MarginBottom, int MarginLeft, int MarginTop, int MarginRight) {
 		this.Type = Type;
 		this.VarX = VarX;
 		this.VarY = VarY;
 		this.Palette = Palette;
 		this.Transposed = Transposed;
+		this.LineWidth = LineWidth;
 		this.Width = Width;
 		this.Height = Height;
 		this.Legend = Legend;
@@ -66,17 +68,18 @@ public class GraphROptions
 		this.VarY = strFull[2];
 		this.Palette = strFull[3];
 		this.Transposed = Util.StringToBool(strFull[4]);
-		this.Width = Convert.ToInt32(strFull[5]);
-		this.Height = Convert.ToInt32(strFull[6]);
-		this.Legend = strFull[7];
-		this.MarginBottom = Convert.ToInt32(strFull[8]);
-		this.MarginLeft = Convert.ToInt32(strFull[9]);
-		this.MarginTop = Convert.ToInt32(strFull[10]);
-		this.MarginRight = Convert.ToInt32(strFull[11]);
+		this.LineWidth = Convert.ToInt32(strFull[5]);
+		this.Width = Convert.ToInt32(strFull[6]);
+		this.Height = Convert.ToInt32(strFull[7]);
+		this.Legend = strFull[8];
+		this.MarginBottom = Convert.ToInt32(strFull[9]);
+		this.MarginLeft = Convert.ToInt32(strFull[10]);
+		this.MarginTop = Convert.ToInt32(strFull[11]);
+		this.MarginRight = Convert.ToInt32(strFull[12]);
 	}
 
 	public override string ToString() {
-		return Type + ":" + VarX + ":" + VarY + ":" + Palette + ":" + Transposed + ":" + Width + ":" + Height + ":" + Legend + 
+		return Type + ":" + VarX + ":" + VarY + ":" + Palette + ":" + Transposed + ":" + LineWidth + ":" + Width + ":" + Height + ":" + Legend + 
 			":" + MarginBottom + ":" + MarginLeft + ":" + MarginTop + ":" + MarginRight;
 	}
 }	
diff --git a/src/stats/main.cs b/src/stats/main.cs
index bac6637..5a7206a 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1101,7 +1101,7 @@ public class Stat
 		}
 
 		string rG = //rGraphString
-			"boxplot(as.data.frame(data), las=2, xlab=''" + ylabStr + ")\n" +
+			"boxplot(as.data.frame(data), lwd="+ gro.LineWidth +", las=2, xlab=''" + ylabStr + ")\n" +
 			"axis(1, 1:length(colnames(data)), colnames(data), las=2)\n"; //axis separated from boxplot because if data hsa one col, names are not displayed
 		
 		//have an unique title for both graphs
@@ -1138,7 +1138,7 @@ public class Stat
 
 		string rG = //rGraphString
 		   	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
-			"barplot(data, beside=T, col=colors, las=2, xlab=''" + ylabStr + ")\n" +
+			"barplot(data, beside=T, col=colors, lwd="+ gro.LineWidth +", 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
@@ -1203,11 +1203,11 @@ public class Stat
 		string rG = //rGraphString
 		   	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
 			colorsConversionString +
-		   	" plot(data[1,1:length(colnames(data))], type='b', xlim=" + xlimString + "," +
+		   	" plot(data[1,1:length(colnames(data))], type='b', lwd="+ gro.LineWidth +", xlim=" + xlimString + "," +
 			" ylim=c(min(data" + naString +"),max(data" + naString + ")), pch=1, axes=FALSE, col="+ colors1 +", 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="+ colorsi +")\n" +
+		   	" 		points(data[i,1:length(colnames(data))], type='b', lwd="+ gro.LineWidth +", pch=i, col="+ colorsi +")\n" +
 			" }\n" +
 			" axis(1, 1:length(colnames(data)), colnames(data), las=2)\n" +
 			axesStr + 
@@ -1244,7 +1244,7 @@ public class Stat
 		}
 
 		string rG = //rGraphString
-			"stripchart(as.data.frame(data), las=2" + xlabStr + ", ylab='', method='jitter', pch=3, jitter=.2)\n" +
+			"stripchart(as.data.frame(data), lwd="+ gro.LineWidth +", las=2" + xlabStr + ", ylab='', method='jitter', pch=3, jitter=.2)\n" +
 			"axis(2, 1:length(colnames(data)), colnames(data), las=2)\n"; //axis separated from boxplot because if data hsa one col, names are not displayed
 		
 		//have an unique title for both graphs
@@ -1281,17 +1281,17 @@ public class Stat
 			"rang <- c(1:length(rownames(data)))\n" +
 			//"plot(serie0, serie1, pch=rang, col="+ colors +", xlab='" + Util.RemoveTilde(gro.VarX) + "', ylab='" + Util.RemoveTilde(gro.VarY) + "')\n" +
 			"plot(serie0,serie1,xlim=c(min(serie0),max(serie0)),ylim=c(min(serie1),max(serie1)), " + 
-			"pch=rang, col="+ colors +", xlab='" + Util.RemoveTilde(gro.VarX) + 
+			"pch=rang, lwd="+ gro.LineWidth +", col="+ colors +", xlab='" + Util.RemoveTilde(gro.VarX) + 
 			"', ylab='" + Util.RemoveTilde(gro.VarY) + "')\n" +
 			"legend('" + gro.Legend +"' ,legend=rownames(data), pch=rang, col="+ colors +", cex=.7)\n" +
 			titStr + "\n" +
 	
 			"mylm<-lm(serie1~serie0)\n" +
-			"abline(mylm,col='red')\n" +
+			"abline(mylm,col='red', lwd="+ gro.LineWidth +")\n" +
 			"newx<-seq(min(serie0),max(serie0),length.out=length(serie0))\n" +
 			"prd<-predict(mylm,newdata=data.frame(serie0=newx),interval = c('confidence'), level = 0.90,type='response')\n" +
-			"lines(newx,prd[,3],col='red',lty=2)\n" +
-			"lines(newx,prd[,2],col='red',lty=2)\n" +
+			"lines(newx,prd[,3],col='red', lwd="+ gro.LineWidth +",lty=2)\n" +
+			"lines(newx,prd[,2],col='red', lwd="+ gro.LineWidth +",lty=2)\n" +
 			"text(newx[1],prd[1,3],'90%', cex=0.6)\n" +
 			"text(newx[1],prd[1,2],'90%', cex=0.6)\n" +
 			"text(newx[length(newx)],prd[length(newx),3],'90%', cex=0.6)\n" +
@@ -1308,9 +1308,9 @@ public class Stat
 		string titStr = getTitle("Histogram","");
 		string rG = //rGraphString
 			
-			"hist(serie0, main='', xlab=colnames(data)[1], cex=1)\n" +
-			"abline(v=mean(serie0), lty=1, col='grey20')\n" +
-			"abline(v=median(serie0), lty=2, col='grey40')\n" +
+			"hist(serie0, main='', lwd="+ gro.LineWidth +", xlab=colnames(data)[1], cex=1)\n" +
+			"abline(v=mean(serie0), lwd="+ gro.LineWidth +", lty=1, col='grey20')\n" +
+			"abline(v=median(serie0), lwd="+ gro.LineWidth +", lty=2, col='grey40')\n" +
 			"mtext('avg', at=mean(serie0), side=3, cex=.7, col='grey20')\n" +
 			"mtext('median', at=median(serie0), side=1, cex=.7, col='grey40')\n" +
 			titStr;
@@ -1322,9 +1322,9 @@ public class Stat
 		string allData = convertDataToR(gro, Sides.ALL);
 		string titStr = getTitle("Dotchart","");
 		string rG = //rGraphString
-			"dotchart(serie0, labels=rownames(data), xlab=colnames(data)[1], cex=1)\n" +
-			"abline(v=mean(serie0), lty=1, col='grey20')\n" +
-			"abline(v=median(serie0), lty=2, col='grey40')\n" +
+			"dotchart(serie0, labels=rownames(data), xlab=colnames(data)[1], lwd="+ gro.LineWidth +", cex=1)\n" +
+			"abline(v=mean(serie0), lwd="+ gro.LineWidth +", lty=1, col='grey20')\n" +
+			"abline(v=median(serie0), lwd="+ gro.LineWidth +", lty=2, col='grey40')\n" +
 			"mtext('avg', at=mean(serie0), side=3, cex=.7, col='grey20')\n" +
 			"mtext('median', at=median(serie0), side=1, cex=.7, col='grey40')\n" +
 			titStr;



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