[chronojump] Added graphs X axis font size



commit 30477dbfb97c063ef1c429338e44c1a48acc1581
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Apr 9 14:38:28 2011 +0200

    Added graphs X axis font size

 glade/chronojump.glade            |   63 ++++++++++++++++++++++++++++++++----
 src/gui/stats.cs                  |   20 +++++++++++-
 src/stats/graphs/graphROptions.cs |    7 +++-
 src/stats/main.cs                 |    6 +++-
 4 files changed, 85 insertions(+), 11 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 3bfdcd4..c810d85 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -13902,7 +13902,7 @@ by you</property>
                           <widget class="GtkViewport" id="viewport_mode">
                             <property name="visible">True</property>
                             <property name="resize_mode">queue</property>
-                            <property name="hadjustment">0 0 738 73.799999999999997 664.20000000000005 738</property>
+                            <property name="hadjustment">0 0 730 73 657 730</property>
                             <property name="shadow_type">out</property>
                             <child>
                               <widget class="GtkHButtonBox" id="hbuttonbox2">
@@ -21933,15 +21933,15 @@ Second Chronopic to platforms.</property>
                                                     <child>
                                                       <widget class="GtkHBox" id="hbox_graph_margins">
                                                         <property name="visible">True</property>
-                                                        <property name="spacing">20</property>
+                                                        <property name="spacing">4</property>
                                                         <child>
                                                           <widget class="GtkHBox" id="hbox383">
                                                             <property name="visible">True</property>
-                                                            <property name="spacing">12</property>
+                                                            <property name="spacing">8</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox384">
                                                             <property name="visible">True</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">2</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label777">
                                                             <property name="visible">True</property>
@@ -21978,7 +21978,7 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox385">
                                                             <property name="visible">True</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">2</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label778">
                                                             <property name="visible">True</property>
@@ -22015,7 +22015,7 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox386">
                                                             <property name="visible">True</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">2</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label779">
                                                             <property name="visible">True</property>
@@ -22052,7 +22052,7 @@ Second Chronopic to platforms.</property>
                                                             <child>
                                                             <widget class="GtkHBox" id="hbox387">
                                                             <property name="visible">True</property>
-                                                            <property name="spacing">6</property>
+                                                            <property name="spacing">2</property>
                                                             <child>
                                                             <widget class="GtkLabel" id="label780">
                                                             <property name="visible">True</property>
@@ -22086,6 +22086,54 @@ Second Chronopic to platforms.</property>
                                                             <property name="position">3</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkVSeparator" id="vseparator_stats_x_axis">
+                                                            <property name="visible">True</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="position">4</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkHBox" id="hbox_stats_x_axis">
+                                                            <property name="visible">True</property>
+                                                            <property name="spacing">2</property>
+                                                            <child>
+                                                            <widget class="GtkLabel" id="label66">
+                                                            <property name="visible">True</property>
+                                                            <property name="tooltip" translatable="yes">Adjust this and bottom margin if athlete's names are long.</property>
+                                                            <property name="label" translatable="yes">X axis font size</property>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">False</property>
+                                                            <property name="fill">False</property>
+                                                            <property name="position">0</property>
+                                                            </packing>
+                                                            </child>
+                                                            <child>
+                                                            <widget class="GtkSpinButton" id="spin_graph_x_cex_axis">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="invisible_char">â??</property>
+                                                            <property name="adjustment">0.80000000000000004 0.5 1 0.10000000000000001 1 0</property>
+                                                            <property name="climb_rate">1</property>
+                                                            <property name="digits">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="expand">False</property>
+                                                            <property name="position">5</property>
+                                                            </packing>
+                                                            </child>
                                                           </widget>
                                                           <packing>
                                                             <property name="expand">False</property>
@@ -22104,6 +22152,7 @@ Second Chronopic to platforms.</property>
                                                           <packing>
                                                             <property name="expand">False</property>
                                                             <property name="fill">False</property>
+                                                            <property name="pack_type">end</property>
                                                             <property name="position">1</property>
                                                           </packing>
                                                         </child>
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index c93a8ff..46492c4 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -112,6 +112,10 @@ public partial class ChronoJumpWindow {
 	[Widget] Gtk.SpinButton spin_graph_margin_l; //left
 	[Widget] Gtk.SpinButton spin_graph_margin_t; //top
 	[Widget] Gtk.SpinButton spin_graph_margin_r; //right
+	[Widget] Gtk.SpinButton spin_graph_x_cex_axis; //font size of x axis
+		
+	[Widget] Gtk.VSeparator vseparator_stats_x_axis;
+	[Widget] Gtk.HBox hbox_stats_x_axis;
 
 	//bool statsAutomatic = true;
 	bool statsAutomatic = false;
@@ -460,6 +464,11 @@ public partial class ChronoJumpWindow {
 		hbox_combo_graph_var_x.Visible = show;
 		hbox_combo_graph_var_y.Visible = show;
 	}
+			
+	private void showXAxisOptions(bool show) {
+		vseparator_stats_x_axis.Visible = show;
+		hbox_stats_x_axis.Visible = show;
+	}
 
 	private void on_combo_graph_type_changed(object o, EventArgs args) {
 		if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
@@ -495,6 +504,13 @@ public partial class ChronoJumpWindow {
 			label_graph_legend.Visible = true;
 			combo_graph_legend.Visible = true;
 		}
+		
+		showXAxisOptions(false);
+
+		//barplot and lines can have font size on X axis
+		if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeBarplot ||
+				UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeLines)
+			showXAxisOptions(true);
 	}
 	
 	private void on_button_graph_margin_default_clicked(object o, EventArgs args) {
@@ -502,6 +518,7 @@ public partial class ChronoJumpWindow {
 		spin_graph_margin_l.Value = 4;
 		spin_graph_margin_t.Value = 4;
 		spin_graph_margin_r.Value = 2;
+		spin_graph_x_cex_axis.Value = 0.8;
 	}
 
 	private void on_combo_select_checkboxes_changed(object o, EventArgs args) {
@@ -751,7 +768,8 @@ public partial class ChronoJumpWindow {
 				Convert.ToInt32(spin_graph_margin_b.Value), 
 				Convert.ToInt32(spin_graph_margin_l.Value), 
 				Convert.ToInt32(spin_graph_margin_t.Value), 
-				Convert.ToInt32(spin_graph_margin_r.Value) 
+				Convert.ToInt32(spin_graph_margin_r.Value),
+				Convert.ToDouble(spin_graph_x_cex_axis.Value)
 				);
 	}
 
diff --git a/src/stats/graphs/graphROptions.cs b/src/stats/graphs/graphROptions.cs
index c190100..70e38d9 100644
--- a/src/stats/graphs/graphROptions.cs
+++ b/src/stats/graphs/graphROptions.cs
@@ -39,10 +39,11 @@ public class GraphROptions
 	public int MarginLeft;
 	public int MarginTop;
 	public int MarginRight;
+	public double XAxisFontSize;
 	
 	public GraphROptions(string Type, string VarX, string VarY, string Palette, bool Transposed, 
 			int LineWidth, int Width, int Height, string Legend,
-			int MarginBottom, int MarginLeft, int MarginTop, int MarginRight) {
+			int MarginBottom, int MarginLeft, int MarginTop, int MarginRight, double XAxisFontSize) {
 		this.Type = Type;
 		this.VarX = VarX;
 		this.VarY = VarY;
@@ -56,6 +57,7 @@ public class GraphROptions
 		this.MarginLeft = MarginLeft;
 		this.MarginTop = MarginTop;
 		this.MarginRight = MarginRight;
+		this.XAxisFontSize = XAxisFontSize;
 	}
 	public GraphROptions() {
 	}
@@ -76,10 +78,11 @@ public class GraphROptions
 		this.MarginLeft = Convert.ToInt32(strFull[10]);
 		this.MarginTop = Convert.ToInt32(strFull[11]);
 		this.MarginRight = Convert.ToInt32(strFull[12]);
+		this.XAxisFontSize = Convert.ToDouble(strFull[13]);
 	}
 
 	public override string ToString() {
 		return Type + ":" + VarX + ":" + VarY + ":" + Palette + ":" + Transposed + ":" + LineWidth + ":" + Width + ":" + Height + ":" + Legend + 
-			":" + MarginBottom + ":" + MarginLeft + ":" + MarginTop + ":" + MarginRight;
+			":" + MarginBottom + ":" + MarginLeft + ":" + MarginTop + ":" + MarginRight + ":" + XAxisFontSize;
 	}
 }	
diff --git a/src/stats/main.cs b/src/stats/main.cs
index a54a58a..77ab925 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -1387,10 +1387,14 @@ public class Stat
 		//a file path uses Unix-like path separator '/'		
 		fileName = fileName.Replace("\\","/");
 		
+		string cexAxisString = "";
+		if(gRO.Type == Constants.GraphTypeBarplot || gRO.Type == Constants.GraphTypeLines) 
+			cexAxisString = ", cex.axis=" + Util.ConvertToPoint(gRO.XAxisFontSize);
+		
 		string rString = "png(filename = '" + fileName + "'\n" + 
 			" , width = " + gRO.Width + ", height = " + gRO.Height + ", units = 'px'\n" +
 			" , pointsize = 12, bg = 'white', res = NA)\n";
-		rString += "par(mar=c(" + gRO.MarginBottom + "," + gRO.MarginLeft + "," + gRO.MarginTop + "," + gRO.MarginRight + "))\n";
+		rString += "par(mar=c(" + gRO.MarginBottom + "," + gRO.MarginLeft + "," + gRO.MarginTop + "," + gRO.MarginRight + ")" + cexAxisString + ")\n";
 
 		if(gRO.Type == Constants.GraphTypeBoxplot) {
 			if(hasTwoAxis()) {



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