[chronojump] done barplot, lines, XY



commit 5c52fae773117bbb4555ea5cf43133ef1fd7f09f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Sep 1 18:50:56 2009 +0200

    done barplot, lines, XY
    compiles without nplot stuff

 Makefile.am                                |    4 +-
 TODO.txt                                   |    2 +
 chronojump_server/bin/chronojumpServer.dll |  Bin 272384 -> 272384 bytes
 glade/chronojump.glade                     |  497 ++++++++++++++++++++++++++--
 src/Makefile.am                            |    7 +-
 src/constants.cs                           |    8 +
 src/gui/stats.cs                           |  164 +++++++++-
 src/report.cs                              |   20 ++
 src/statType.cs                            |   39 +++-
 src/stats/graphs/djIndex.cs                |   12 +-
 src/stats/graphs/djQ.cs                    |   10 +-
 src/stats/graphs/fv.cs                     |   10 +-
 src/stats/graphs/global.cs                 |   15 +-
 src/stats/graphs/graphData.cs              |    3 +
 src/stats/graphs/graphROptions.cs          |   51 +++
 src/stats/graphs/graphSerie.cs             |   11 +-
 src/stats/graphs/ieIub.cs                  |   10 +-
 src/stats/graphs/potency.cs                |   10 +-
 src/stats/graphs/rjAVGSD.cs                |    8 +-
 src/stats/graphs/rjEvolution.cs            |    8 +-
 src/stats/graphs/rjIndex.cs                |   10 +-
 src/stats/graphs/rjPotencyBosco.cs         |   10 +-
 src/stats/graphs/sjCmjAbk.cs               |   15 +-
 src/stats/graphs/sjCmjAbkPlus.cs           |   23 +-
 src/stats/main.cs                          |  376 +++++++++++++++++-----
 src/stats/sjCmjAbkPlus.cs                  |    2 +-
 src/utilGtk.cs                             |   13 +
 27 files changed, 1155 insertions(+), 183 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 85c6d04..40ffb9c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -3,8 +3,8 @@ EXTRA_DIST =
 ACLOCAL_AMFLAGS = -I m4
 
 if ENABLE_DEBUG
- SUBDIRS =  chronojump_server chronopic-tests   nplot src po manual 
+ SUBDIRS =  chronojump_server chronopic-tests   src po manual 
 endif
 if ENABLE_RELEASE
- SUBDIRS = chronojump_server chronopic-tests   nplot src po manual 
+ SUBDIRS = chronojump_server chronopic-tests   src po manual 
 endif
diff --git a/TODO.txt b/TODO.txt
index d757a82..b08963f 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -2,6 +2,8 @@ TODO:
 
 bug: when crash it shows to update to a version that is not last
 
+on graphs xy do that same variable cannot be checked. Also ensure XY, YX works
+
 check all software (for the Util.TrimDecimals change)
 create accept license on uploading
 add accept license on uploading, and a way to retreive it from server
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 26a9aba..3141929 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 9fe68db..93c5877 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -5840,17 +5840,435 @@ options</property>
       </child>
 
       <child>
-	<widget class="GtkHBox" id="hbox251">
+	<widget class="GtkTable" id="table75">
 	  <property name="visible">True</property>
+	  <property name="n_rows">2</property>
+	  <property name="n_columns">2</property>
 	  <property name="homogeneous">False</property>
-	  <property name="spacing">20</property>
+	  <property name="row_spacing">4</property>
+	  <property name="column_spacing">10</property>
 
 	  <child>
-	    <widget class="GtkHButtonBox" id="hbuttonbox18">
-	      <property name="border_width">4</property>
+	    <widget class="GtkHBox" id="hbox375">
 	      <property name="visible">True</property>
-	      <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
-	      <property name="spacing">6</property>
+	      <property name="homogeneous">False</property>
+	      <property name="spacing">4</property>
+
+	      <child>
+		<widget class="GtkTable" id="table74">
+		  <property name="visible">True</property>
+		  <property name="n_rows">2</property>
+		  <property name="n_columns">8</property>
+		  <property name="homogeneous">False</property>
+		  <property name="row_spacing">4</property>
+		  <property name="column_spacing">4</property>
+
+		  <child>
+		    <widget class="GtkCheckButton" id="checkbutton_transposed">
+		      <property name="visible">True</property>
+		      <property name="tooltip" translatable="yes">Transpose</property>
+		      <property name="can_focus">True</property>
+		      <property name="label" translatable="yes">T</property>
+		      <property name="use_underline">True</property>
+		      <property name="relief">GTK_RELIEF_NORMAL</property>
+		      <property name="focus_on_click">True</property>
+		      <property name="active">False</property>
+		      <property name="inconsistent">False</property>
+		      <property name="draw_indicator">True</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">7</property>
+		      <property name="right_attach">8</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_type">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_palette">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">3</property>
+		      <property name="right_attach">4</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label764">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Type</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">0</property>
+		      <property name="right_attach">1</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label765">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Palette</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">3</property>
+		      <property name="right_attach">4</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_width">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">4</property>
+		      <property name="right_attach">5</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label766">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Width</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">4</property>
+		      <property name="right_attach">5</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label_graph_var_x">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">var X</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">2</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label_graph_var_y">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">var Y</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">2</property>
+		      <property name="right_attach">3</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_var_x">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">1</property>
+		      <property name="right_attach">2</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_var_y">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">2</property>
+		      <property name="right_attach">3</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label_graph_options">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Options</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">7</property>
+		      <property name="right_attach">8</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label770">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Legend</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">6</property>
+		      <property name="right_attach">7</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_legend">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">6</property>
+		      <property name="right_attach">7</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkLabel" id="label771">
+		      <property name="visible">True</property>
+		      <property name="label" translatable="yes">Height</property>
+		      <property name="use_underline">False</property>
+		      <property name="use_markup">False</property>
+		      <property name="justify">GTK_JUSTIFY_LEFT</property>
+		      <property name="wrap">False</property>
+		      <property name="selectable">False</property>
+		      <property name="xalign">0</property>
+		      <property name="yalign">0.5</property>
+		      <property name="xpad">0</property>
+		      <property name="ypad">0</property>
+		      <property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
+		      <property name="width_chars">-1</property>
+		      <property name="single_line_mode">False</property>
+		      <property name="angle">0</property>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">5</property>
+		      <property name="right_attach">6</property>
+		      <property name="top_attach">0</property>
+		      <property name="bottom_attach">1</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options"></property>
+		    </packing>
+		  </child>
+
+		  <child>
+		    <widget class="GtkHBox" id="hbox_combo_graph_height">
+		      <property name="visible">True</property>
+		      <property name="homogeneous">False</property>
+		      <property name="spacing">0</property>
+
+		      <child>
+			<placeholder/>
+		      </child>
+		    </widget>
+		    <packing>
+		      <property name="left_attach">5</property>
+		      <property name="right_attach">6</property>
+		      <property name="top_attach">1</property>
+		      <property name="bottom_attach">2</property>
+		      <property name="x_options">fill</property>
+		      <property name="y_options">fill</property>
+		    </packing>
+		  </child>
+		</widget>
+		<packing>
+		  <property name="padding">0</property>
+		  <property name="expand">False</property>
+		  <property name="fill">False</property>
+		</packing>
+	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">0</property>
+	      <property name="bottom_attach">1</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHButtonBox" id="hbuttonbox48">
+	      <property name="visible">True</property>
+	      <property name="layout_style">GTK_BUTTONBOX_END</property>
+	      <property name="spacing">0</property>
 
 	      <child>
 		<widget class="GtkButton" id="button_graph">
@@ -5997,38 +6415,42 @@ options</property>
 		  </child>
 		</widget>
 	      </child>
+	    </widget>
+	    <packing>
+	      <property name="left_attach">0</property>
+	      <property name="right_attach">1</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="y_options"></property>
+	    </packing>
+	  </child>
+
+	  <child>
+	    <widget class="GtkHButtonBox" id="hbuttonbox49">
+	      <property name="visible">True</property>
+	      <property name="layout_style">GTK_BUTTONBOX_END</property>
+	      <property name="spacing">0</property>
 
 	      <child>
-		<widget class="GtkAlignment" id="alignment107">
+		<widget class="GtkButton" id="button_close">
 		  <property name="visible">True</property>
-		  <property name="xalign">1</property>
-		  <property name="yalign">0.5</property>
-		  <property name="xscale">1</property>
-		  <property name="yscale">1</property>
-		  <property name="top_padding">0</property>
-		  <property name="bottom_padding">0</property>
-		  <property name="left_padding">25</property>
-		  <property name="right_padding">0</property>
-
-		  <child>
-		    <widget class="GtkButton" id="button_close">
-		      <property name="visible">True</property>
-		      <property name="can_default">True</property>
-		      <property name="can_focus">True</property>
-		      <property name="label">gtk-close</property>
-		      <property name="use_stock">True</property>
-		      <property name="relief">GTK_RELIEF_NORMAL</property>
-		      <property name="focus_on_click">True</property>
-		      <signal name="clicked" handler="on_button_close_clicked" last_modification_time="Thu, 04 Oct 2007 15:32:13 GMT"/>
-		    </widget>
-		  </child>
+		  <property name="can_default">True</property>
+		  <property name="can_focus">True</property>
+		  <property name="label">gtk-close</property>
+		  <property name="use_stock">True</property>
+		  <property name="relief">GTK_RELIEF_NORMAL</property>
+		  <property name="focus_on_click">True</property>
+		  <signal name="clicked" handler="on_button_close_clicked" last_modification_time="Tue, 01 Sep 2009 16:10:56 GMT"/>
 		</widget>
 	      </child>
 	    </widget>
 	    <packing>
-	      <property name="padding">0</property>
-	      <property name="expand">True</property>
-	      <property name="fill">True</property>
+	      <property name="left_attach">1</property>
+	      <property name="right_attach">2</property>
+	      <property name="top_attach">1</property>
+	      <property name="bottom_attach">2</property>
+	      <property name="x_options">fill</property>
+	      <property name="y_options">fill</property>
 	    </packing>
 	  </child>
 	</widget>
@@ -6040,6 +6462,19 @@ options</property>
       </child>
 
       <child>
+	<widget class="GtkHButtonBox" id="hbuttonbox47">
+	  <property name="visible">True</property>
+	  <property name="layout_style">GTK_BUTTONBOX_DEFAULT_STYLE</property>
+	  <property name="spacing">0</property>
+	</widget>
+	<packing>
+	  <property name="padding">0</property>
+	  <property name="expand">False</property>
+	  <property name="fill">True</property>
+	</packing>
+      </child>
+
+      <child>
 	<widget class="GtkStatusbar" id="statusbar_stats">
 	  <property name="visible">True</property>
 	  <property name="has_resize_grip">True</property>
diff --git a/src/Makefile.am b/src/Makefile.am
index 4f81629..39e8a06 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -103,6 +103,7 @@ FILES = \
  	stats/potency.cs\
  	stats/rjAVGSD.cs\
 	stats/graphs/graphData.cs\
+ 	stats/graphs/graphROptions.cs\
  	stats/graphs/graphSerie.cs\
  	stats/graphs/global.cs\
  	stats/graphs/sjCmjAbk.cs\
@@ -308,9 +309,9 @@ REFERENCES =  \
 
 
 
-DLL_REFERENCES =  \
-	../nplot/nplot/bin/NPlot.dll\
-	../nplot/nplot-gtk/bin/NPlot.Gtk.dll
+#DLL_REFERENCES =  \
+#	../nplot/nplot/bin/NPlot.dll\
+#	../nplot/nplot-gtk/bin/NPlot.Gtk.dll
 
 
 #CLEANFILES = $(COMMONAPPLICATIONDATA_ROOT) $(COMMONAPPLICATIONDATAROOT_IMAGES) $(COMMONAPPLICATIONDATAROOT_LOGO) $(PROGRAMFILES) $(LINUX_DESKTOPAPPLICATIONS) $(BINARIES) 
diff --git a/src/constants.cs b/src/constants.cs
index ce3fd1a..dda696f 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -236,6 +236,14 @@ public class Constants
 	
 	public static string FileNameRGraph = "r-graph.png";
 	public static string FileNameRScript = "r-graph.txt";
+	public static string GraphTypeBarplot = "Barplot";
+	public static string GraphTypeLines = "Lines";
+	public static string GraphTypeXY = "XY";
+	public static string GraphTypeDotchart = "Dotchart";
+	//public static string [] GraphTypes = { GraphTypeBarplot, GraphTypeLines, GraphTypeXY, GraphTypeDotchart };
+	public static string [] GraphTypes = { GraphTypeBarplot, GraphTypeLines, GraphTypeXY };
+	public static string [] GraphPalettes = { "rainbow", "heat.colors", "gray.colors", "topo.colors" };
+
 
 	public static string FileNameZoomFitIcon = "gtk-zoom-fit.png";
 	//public static string FileNameZoomOutIcon = "gtk-zoom-out.png";
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 1af6bbd..b96f4c4 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -72,6 +72,25 @@ public class StatsWindow {
 	[Widget] Gtk.Image image_stats_win_graph;
 	[Widget] Gtk.Image image_stats_win_report;
 	[Widget] Gtk.Statusbar statusbar_stats;
+	
+	[Widget] Gtk.Box hbox_combo_graph_type;
+	[Widget] Gtk.Label label_graph_var_x;
+	[Widget] Gtk.Label label_graph_var_y;
+	[Widget] Gtk.Box hbox_combo_graph_var_x;
+	[Widget] Gtk.Box hbox_combo_graph_var_y;
+	[Widget] Gtk.Box hbox_combo_graph_palette;
+	[Widget] Gtk.ComboBox combo_graph_type;
+	[Widget] Gtk.ComboBox combo_graph_var_x;
+	[Widget] Gtk.ComboBox combo_graph_var_y;
+	[Widget] Gtk.ComboBox combo_graph_palette;
+	[Widget] Gtk.Label label_graph_options;
+	[Widget] Gtk.CheckButton checkbutton_transposed;
+	[Widget] Gtk.Box hbox_combo_graph_width;
+	[Widget] Gtk.Box hbox_combo_graph_height;
+	[Widget] Gtk.ComboBox combo_graph_width;
+	[Widget] Gtk.ComboBox combo_graph_height;
+	[Widget] Gtk.Box hbox_combo_graph_legend;
+	[Widget] Gtk.ComboBox combo_graph_legend;
 
 	int prefsDigitsNumber;
 	bool heightPreferred;
@@ -94,7 +113,7 @@ public class StatsWindow {
 	private bool blockFillingTreeview;
 
 	private static string [] comboStatsTypeOptions = {
-		Constants.TypeSessionSummary,
+//		Constants.TypeSessionSummary, //deactivated until R is fully implemented
 		Constants.TypeJumperSummary,
 		Constants.TypeJumpsSimple,
 		Constants.TypeJumpsSimpleWithTC,
@@ -143,6 +162,22 @@ public class StatsWindow {
 		Catalog.GetString("Female")
 	};
 	
+	private static string [] comboGraphSizeOptions = {
+		"300", "400", "500", "600", "700", "800", "1000", "1100", "1200"
+	};
+	
+	private static string [] comboGraphLegendOptions = {
+		"bottomright",
+		"bottom",
+		"bottomleft",
+		"left",
+		"topleft",
+		"top",
+		"topright",
+		"right",
+		"center"
+	};
+	
 	//useful for removing users from the combo
 	private static string [] comboCheckboxesOptionsWithoutPersons = comboCheckboxesOptions;
 
@@ -189,6 +224,15 @@ public class StatsWindow {
 		createComboStatsSubType();
 		createComboStatsApplyTo();
 	
+		createComboGraphType();
+		
+		createComboGraphVars();
+		showGraphXYStuff(false);
+
+		createComboGraphPalette();
+		createComboGraphSize();
+		createComboGraphLegend();
+	
 		// here doesn't do Ok the job, done later in Initialize
 		//blockFillingTreeview = false;
 
@@ -216,7 +260,8 @@ public class StatsWindow {
 		}
 		
 		//button update stats is unsensitive until a test finished
-		StatsWindowBox.button_stats.Sensitive = false;
+		//StatsWindowBox.button_stats.Sensitive = false;
+		StatsWindowBox.button_stats.Visible = false;
 
 		StatsWindowBox.stats_window.Show ();
 		
@@ -254,7 +299,7 @@ public class StatsWindow {
 			treeview_stats.RemoveColumn (column);
 		}
 	}
-
+	
 	private void createComboStatsType() {
 		combo_stats_stat_type = ComboBox.NewText ();
 		UtilGtk.ComboUpdate(combo_stats_stat_type, comboStatsTypeOptions, "");
@@ -299,6 +344,88 @@ public class StatsWindow {
 		combo_select_checkboxes.Sensitive = true;
 	}
 	
+	private void createComboGraphType() {
+		combo_graph_type = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_type, Constants.GraphTypes, "");
+		combo_graph_type.Active=0;
+		
+		combo_graph_type.Changed += new EventHandler (on_combo_graph_type_changed);
+		
+		hbox_combo_graph_type.PackStart(combo_graph_type, true, true, 0);
+		hbox_combo_graph_type.ShowAll();
+		combo_graph_type.Sensitive = true;
+	}
+
+	private void createComboGraphVars() {
+		combo_graph_var_x = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_var_x, UtilGtk.GetCols(treeview_stats, 2), ""); //2 for not getting the checkbox and the text column
+		combo_graph_var_x.Active=0;
+		hbox_combo_graph_var_x.PackStart(combo_graph_var_x, true, true, 0);
+		hbox_combo_graph_var_x.ShowAll();
+		combo_graph_var_x.Sensitive = true;
+		
+		combo_graph_var_y = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_var_y, UtilGtk.GetCols(treeview_stats, 2), "");
+		combo_graph_var_y.Active=0;
+		hbox_combo_graph_var_y.PackStart(combo_graph_var_y, true, true, 0);
+		hbox_combo_graph_var_y.ShowAll();
+		combo_graph_var_y.Sensitive = true;
+	}
+	
+	private void createComboGraphPalette() {
+		combo_graph_palette = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_palette, Constants.GraphPalettes, "");
+		combo_graph_palette.Active=0;
+		
+		hbox_combo_graph_palette.PackStart(combo_graph_palette, true, true, 0);
+		hbox_combo_graph_palette.ShowAll();
+		combo_graph_palette.Sensitive = true;
+	}
+
+	private void createComboGraphSize() {
+		combo_graph_width = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_width, comboGraphSizeOptions, "");
+		combo_graph_width.Active=2; //500
+		
+		hbox_combo_graph_width.PackStart(combo_graph_width, true, true, 0);
+		hbox_combo_graph_width.ShowAll();
+		combo_graph_width.Sensitive = true;
+		
+		combo_graph_height = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_height, comboGraphSizeOptions, "");
+		combo_graph_height.Active=2; //500
+		
+		hbox_combo_graph_height.PackStart(combo_graph_height, true, true, 0);
+		hbox_combo_graph_height.ShowAll();
+		combo_graph_height.Sensitive = true;
+	}
+	
+	private void createComboGraphLegend() {
+		combo_graph_legend = ComboBox.NewText ();
+		UtilGtk.ComboUpdate(combo_graph_legend, comboGraphLegendOptions, "");
+		combo_graph_legend.Active=0;
+		
+		hbox_combo_graph_legend.PackStart(combo_graph_legend, true, true, 0);
+		hbox_combo_graph_legend.ShowAll();
+		combo_graph_legend.Sensitive = true;
+	}
+	
+	private void showGraphXYStuff(bool show) {
+		label_graph_var_x.Visible = show;
+		label_graph_var_y.Visible = show;
+		hbox_combo_graph_var_x.Visible = show;
+		hbox_combo_graph_var_y.Visible = show;
+		label_graph_options.Visible = ! show;
+		checkbutton_transposed.Visible = ! show;
+	}
+
+	private void on_combo_graph_type_changed(object o, EventArgs args) {
+		if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
+			showGraphXYStuff(true);
+		else
+			showGraphXYStuff(false);
+	}
+
 	private void on_combo_select_checkboxes_changed(object o, EventArgs args) {
 		string myText = UtilGtk.ComboGetActive(combo_select_checkboxes);
 			
@@ -520,6 +647,17 @@ public class StatsWindow {
 		//if there's no data, they will be hided, later
 		button_graph.Sensitive = true;
 		button_add_to_report.Sensitive = true;
+
+		GraphROptions graphROptions = new GraphROptions(
+				UtilGtk.ComboGetActive(combo_graph_type),
+				UtilGtk.ComboGetActive(combo_graph_var_x),
+				UtilGtk.ComboGetActive(combo_graph_var_y),
+				UtilGtk.ComboGetActive(combo_graph_palette),
+				checkbutton_transposed.Active,
+				Convert.ToInt32(UtilGtk.ComboGetActive(combo_graph_width)),
+				Convert.ToInt32(UtilGtk.ComboGetActive(combo_graph_height)),
+				UtilGtk.ComboGetActive(combo_graph_legend)
+				);
 		
 		myStatType = new StatType(
 				statisticType,
@@ -535,6 +673,7 @@ public class StatsWindow {
 				weightStatsPercent, 
 				markedRows,
 				rj_evolution_mark_consecutives,
+				graphROptions,
 				graph,
 				toReport  //always false in this class
 				);
@@ -560,7 +699,6 @@ public class StatsWindow {
 				lastStore = myStatType.LastStore;
 		
 
-	
 		myStatType.FakeButtonRowCheckedUnchecked.Clicked += 
 			new EventHandler(on_fake_button_row_checked_clicked);
 		myStatType.FakeButtonRowsSelected.Clicked += 
@@ -593,12 +731,19 @@ public class StatsWindow {
 				comboCheckboxesOptions = comboCheckboxesOptionsWithoutPersons;
 
 			UtilGtk.ComboUpdate(combo_select_checkboxes, comboCheckboxesOptions, "");
+			UtilGtk.ComboUpdate(combo_graph_var_x, UtilGtk.GetCols(treeview_stats, 2), "");
+			UtilGtk.ComboUpdate(combo_graph_var_y, UtilGtk.GetCols(treeview_stats, 2), "");
 		}
 
 		//every time a stat is created, all rows should be checked (except AVG & SD)
 		//but not if we clicked graph
-		if(! graph)
+		if(! graph) {
 			combo_select_checkboxes.Active = UtilGtk.ComboMakeActive(comboCheckboxesOptions, Catalog.GetString("All"));
+			try { 
+				combo_graph_var_x.Active=0;
+				combo_graph_var_y.Active=0;
+			} catch {} //maybe there's no data
+		}
 		
 
 		if(allFine) {
@@ -657,7 +802,8 @@ public class StatsWindow {
 		fillTreeView_stats(false);
 
 		//after update stats it will be unsensitive until a new test is finished
-		button_stats.Sensitive = false;
+		//button_stats.Sensitive = false;
+		button_stats.Visible = false;
 	}
 
 	private void on_button_graph_clicked (object o, EventArgs args) {
@@ -684,10 +830,12 @@ public class StatsWindow {
 	//and user has to do it always by hand
 	//workaround to bug ???????
 	public void HideUpdateStatsButton() {
-		button_stats.Sensitive = false;
+		//button_stats.Sensitive = false;
+		button_stats.Visible = false;
 	}
 	public void ShowUpdateStatsButton() {
-		button_stats.Sensitive = true;
+		//button_stats.Sensitive = true;
+		button_stats.Visible = true;
 	}
 
 
diff --git a/src/report.cs b/src/report.cs
index 920d61d..fb186ac 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -361,6 +361,17 @@ public class Report : ExportSession
 			//bool allFine;
 			//report of stat
 
+			GraphROptions graphROptions = new GraphROptions(
+					//TODO: change this
+					Constants.GraphTypeLines,	//graphType
+					"",				//var X
+					"",				//var y
+					"rainbow",			//graphPalette
+					false,				//graphTransposed
+					500,				//width
+					500,				//height
+					"topright"			//legend
+					);
 
 			myStatType = new StatType(
 					strFull[0], 		//statisticType
@@ -375,6 +386,10 @@ public class Report : ExportSession
 					weightStatsPercent,
 					arrayListMarkedRows,
 					rj_evolution_mark_consecutives,
+					//"",			//graphType
+					//"",			//graphPalette
+					//false,			//graphTransposed
+					graphROptions,
 					false, 			//graph
 					toReport,
 					writer,
@@ -402,6 +417,11 @@ public class Report : ExportSession
 					weightStatsPercent,
 					arrayListMarkedRows,
 					rj_evolution_mark_consecutives,
+					//TODO: change this
+					//Constants.GraphTypeLines,			//graphType
+					//"rainbow",			//graphPalette
+					//false,			//graphTransposed
+					graphROptions,
 					true, 			//graph
 					toReport,
 					writer,
diff --git a/src/statType.cs b/src/statType.cs
index cecd98d..0799547 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -39,6 +39,11 @@ public class StatTypeStruct
 	
 	public ArrayList MarkedRows;
 	
+	//public string GraphType;
+	//public string GraphPalette;
+	//public bool GraphTransposed;
+	public GraphROptions GRO;
+	
 	public bool ToReport;
 	
 	public StatTypeStruct (string statisticApplyTo, 
@@ -46,6 +51,8 @@ public class StatTypeStruct
 			int statsJumpsType, int limit, bool heightPreferred, bool weightStatsPercent, 
 			//int statsJumpsType, int limit, bool heightPreferred, 
 			ArrayList markedRows, 
+			//string graphType, string graphPalette, bool graphTransposed,
+			GraphROptions gRO,
 			bool toReport)
 	{
 		this.StatisticApplyTo = statisticApplyTo;
@@ -57,6 +64,10 @@ public class StatTypeStruct
 		this.HeightPreferred = heightPreferred;
 		this.WeightStatsPercent = weightStatsPercent;
 		this.MarkedRows = markedRows;
+		//this.GraphType = graphType;
+		//this.GraphPalette = graphPalette;
+		//this.GraphTransposed = graphTransposed;
+		this.GRO = gRO;
 		this.ToReport = toReport;
 	}
 }
@@ -78,6 +89,11 @@ public class StatType {
 	
 	ArrayList markedRows;
 	ArrayList personsWithData;
+
+	//string graphType;
+	//string graphPalette;
+	//bool graphTransposed;
+	GraphROptions gRO;
 	
 	bool graph;
 	bool toReport;
@@ -112,7 +128,10 @@ public class StatType {
 			int statsJumpsType, int limit, bool heightPreferred, bool weightStatsPercent,
 			//int statsJumpsType, int limit, bool heightPreferred, 
 			ArrayList markedRows,  
-			int rj_evolution_mark_consecutives, bool graph, bool toReport)
+			int rj_evolution_mark_consecutives, 
+			//string graphType, string graphPalette, bool graphTransposed,
+			GraphROptions gRO,
+			bool graph, bool toReport)
 	{
 		//some of this will disappear when we use myStatTypeStruct in all classes:
 		this.statisticType = statisticType;
@@ -130,6 +149,12 @@ public class StatType {
 		this.markedRows = markedRows;
 		
 		this.rj_evolution_mark_consecutives = rj_evolution_mark_consecutives;
+		
+		//this.graphType = graphType;
+		//this.graphPalette = graphPalette;
+		//this.graphTransposed = graphTransposed;
+		this.gRO = gRO;
+		
 		this.graph = graph;
 		this.toReport = toReport;
 
@@ -139,6 +164,8 @@ public class StatType {
 				statsJumpsType, limit, heightPreferred, weightStatsPercent, 
 				//statsJumpsType, limit, heightPreferred,  
 				markedRows, 
+				//graphType, graphPalette, graphTransposed,
+				gRO,
 				toReport);
 
 		myStat = new Stat(); //create an instance of myStat
@@ -173,6 +200,8 @@ public class StatType {
 			//int statsJumpsType, int limit, bool heightPreferred, 
 			ArrayList markedRows, 
 			int rj_evolution_mark_consecutives, 
+			//string graphType, string graphPalette, bool graphTransposed,
+			GraphROptions gRO,
 			bool graph, bool toReport, TextWriter writer, string fileName)
 	{
 		this.statisticType = statisticType;
@@ -189,6 +218,12 @@ public class StatType {
 		this.markedRows = markedRows;
 		
 		this.rj_evolution_mark_consecutives = rj_evolution_mark_consecutives;
+		
+		//this.graphType = graphType;
+		//this.graphPalette = graphPalette;
+		//this.graphTransposed = graphTransposed;
+		this.gRO = gRO;
+		
 		this.graph = graph;
 		this.toReport = toReport;
 		this.writer = writer;
@@ -200,6 +235,8 @@ public class StatType {
 				statsJumpsType, limit, heightPreferred, weightStatsPercent, 
 				//statsJumpsType, limit, heightPreferred, 
 				markedRows, 
+				//graphType, graphPalette, graphTransposed,
+				gRO,
 				toReport);
 
 		myStat = new Stat(); //create and instance of myStat
diff --git a/src/stats/graphs/djIndex.cs b/src/stats/graphs/djIndex.cs
index 766957f..70e34a9 100644
--- a/src/stats/graphs/djIndex.cs
+++ b/src/stats/graphs/djIndex.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -83,18 +83,18 @@ public class GraphDjIndex : StatDjIndex
 			serieTv.IsLeftAxis = true;
 			serieFall.IsLeftAxis = false;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			serieHeight.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Gray"), 2.0F));
-			//serieTc.SerieMarker = new Marker (Marker.MarkerType.TriangleDown, 
 			serieTc.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Green"), 2.0F));
-			//serieTv.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieTv.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
 			serieFall.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 					6, new Pen (Color.FromName("Chocolate"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -195,8 +195,8 @@ public class GraphDjIndex : StatDjIndex
 				countSeriesGraphColors ++;
 			}
 		
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 		
diff --git a/src/stats/graphs/djQ.cs b/src/stats/graphs/djQ.cs
index fe9007c..27e6def 100644
--- a/src/stats/graphs/djQ.cs
+++ b/src/stats/graphs/djQ.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -83,6 +83,7 @@ public class GraphDjQ : StatDjQ
 			serieTv.IsLeftAxis = true;
 			serieFall.IsLeftAxis = false;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			serieHeight.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
@@ -95,6 +96,7 @@ public class GraphDjQ : StatDjQ
 					6, new Pen (Color.FromName("Blue"), 2.0F));
 			serieFall.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 					6, new Pen (Color.FromName("Chocolate"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -196,8 +198,8 @@ public class GraphDjQ : StatDjQ
 				countSeriesGraphColors ++;
 			}
 			
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/fv.cs b/src/stats/graphs/fv.cs
index 710a11f..b09156a 100644
--- a/src/stats/graphs/fv.cs
+++ b/src/stats/graphs/fv.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -83,6 +83,7 @@ public class GraphFv : StatFv
 			serieJump1.IsLeftAxis = true;
 			serieJump2.IsLeftAxis = true;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			//serieJump1.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
@@ -91,6 +92,7 @@ public class GraphFv : StatFv
 			//serieJump2.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieJump2.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -176,8 +178,8 @@ public class GraphFv : StatFv
 				countSeriesGraphColors ++;
 			}
 		
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/global.cs b/src/stats/graphs/global.cs
index f330e18..6a8881b 100644
--- a/src/stats/graphs/global.cs
+++ b/src/stats/graphs/global.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -79,11 +79,13 @@ public class GraphGlobal : StatGlobal
 			serieIndex.IsLeftAxis = false;
 			serieTv.IsLeftAxis = true;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			//serieTv.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieTv.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -204,13 +206,12 @@ public class GraphGlobal : StatGlobal
 							valueNoSex.StartsWith("RjIndex") || valueNoSex.StartsWith(Constants.RJPotencyBoscoName) || 
 							valueNoSex == "IE" || valueNoSex == "IUB" || valueNoSex == "FV" ) {
 						mySerie.IsLeftAxis = false;
-						mySerie.SerieMarker = new Marker (Marker.MarkerType.Square, 
-								6, new Pen (myColor, 2.0F));
+//						mySerie.SerieMarker = new Marker (Marker.MarkerType.Square, 
+//								6, new Pen (myColor, 2.0F));
 					} else {
 						mySerie.IsLeftAxis = true;
-						//mySerie.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
-						mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-								6, new Pen (myColor, 2.0F));
+//						mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//								6, new Pen (myColor, 2.0F));
 					}
 					myValueBefore = valueNoSex; //for changing later indexQ for indexQ*10
 					mySerie.Title = myValue;
diff --git a/src/stats/graphs/graphData.cs b/src/stats/graphs/graphData.cs
index ad262d1..fa87d38 100644
--- a/src/stats/graphs/graphData.cs
+++ b/src/stats/graphs/graphData.cs
@@ -26,6 +26,9 @@ public class GraphData
 {
 	public string WindowTitle;
 	public string GraphTitle;
+	//public string GraphType;
+	//public string GraphPalette;
+	//public bool GraphTransposed;
 	public ArrayList XAxisNames;
 	public string LabelLeft;
 	public string LabelRight;
diff --git a/src/stats/graphs/graphROptions.cs b/src/stats/graphs/graphROptions.cs
new file mode 100644
index 0000000..fc98799
--- /dev/null
+++ b/src/stats/graphs/graphROptions.cs
@@ -0,0 +1,51 @@
+/*
+ * 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
+ *
+ * Xavier de Blas: 
+ */
+
+using System;
+using System.Data;
+using System.Collections; //ArrayList
+
+//only to easy pass data
+//this is new stuff created when moved to R
+public class GraphROptions
+{
+	public string Type;
+	public string VarX;
+	public string VarY;
+	public string Palette;
+	public bool Transposed;
+	public int Width;
+	public int Height;
+	public string Legend;
+	
+	public GraphROptions(string Type, string VarX, string VarY, string Palette, bool Transposed, 
+			int Width, int Height, string Legend) {
+		this.Type = Type;
+		this.VarX = VarX;
+		this.VarY = VarY;
+		this.Palette = Palette;
+		this.Transposed = Transposed;
+		this.Width = Width;
+		this.Height = Height;
+		this.Legend = Legend;
+	}
+	public GraphROptions() {
+	}
+}	
diff --git a/src/stats/graphs/graphSerie.cs b/src/stats/graphs/graphSerie.cs
index 6239a4b..735659c 100644
--- a/src/stats/graphs/graphSerie.cs
+++ b/src/stats/graphs/graphSerie.cs
@@ -22,8 +22,8 @@ using System;
 using System.Data;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 
@@ -31,7 +31,7 @@ public class GraphSerie
 {
 	public string Title;
 	public bool IsLeftAxis;
-	public Marker SerieMarker;
+	//public Marker SerieMarker;
 	public Color SerieColor;
 	public ArrayList SerieData;
 	public double Avg; //height of avg line
@@ -41,12 +41,13 @@ public class GraphSerie
 		Avg = 0;
 	}
 
-	public GraphSerie(string Title, bool IsLeftAxis, Marker SerieMarker, Color SerieColor, ArrayList SerieData) 
+	//public GraphSerie(string Title, bool IsLeftAxis, Marker SerieMarker, Color SerieColor, ArrayList SerieData) 
+	public GraphSerie(string Title, bool IsLeftAxis, Color SerieColor, ArrayList SerieData) 
 	{
 		this.Title = 		Title;
 		this.IsLeftAxis = 	IsLeftAxis;
 		this.SerieColor =	SerieColor;
-		this.SerieMarker =	SerieMarker;
+		//this.SerieMarker =	SerieMarker;
 		this.SerieData =	SerieData;
 		Avg = 0;
 	}
diff --git a/src/stats/graphs/ieIub.cs b/src/stats/graphs/ieIub.cs
index acd7721..1860916 100644
--- a/src/stats/graphs/ieIub.cs
+++ b/src/stats/graphs/ieIub.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -91,6 +91,7 @@ public class GraphIeIub : StatIeIub
 			serieJump1.IsLeftAxis = true;
 			serieJump2.IsLeftAxis = true;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			//serieJump1.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
@@ -99,6 +100,7 @@ public class GraphIeIub : StatIeIub
 			//serieJump2.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieJump2.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -181,8 +183,8 @@ public class GraphIeIub : StatIeIub
 				countSeriesGraphColors ++;
 			}
 		
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/potency.cs b/src/stats/graphs/potency.cs
index 2c89659..b7d73b0 100644
--- a/src/stats/graphs/potency.cs
+++ b/src/stats/graphs/potency.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -83,6 +83,7 @@ public class GraphPotency : StatPotency
 			serieExtraWeight.IsLeftAxis = false;
 			serieHeight.IsLeftAxis = false;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			seriePersonWeight.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
@@ -91,6 +92,7 @@ public class GraphPotency : StatPotency
 					6, new Pen (Color.FromName("Blue"), 2.0F));
 			serieHeight.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Black"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -183,8 +185,8 @@ public class GraphPotency : StatPotency
 				countSeriesGraphColors ++;
 			}
 			
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/rjAVGSD.cs b/src/stats/graphs/rjAVGSD.cs
index 6a3a7dd..0cd429b 100644
--- a/src/stats/graphs/rjAVGSD.cs
+++ b/src/stats/graphs/rjAVGSD.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -79,12 +79,14 @@ public class GraphRjAVGSD : StatRjAVGSD
 		serieSD.IsLeftAxis = true;
 		serieJumps.IsLeftAxis = false;
 
+		/*
 		serieAVG.SerieMarker = new Marker (Marker.MarkerType.Square, 
 				6, new Pen (Color.FromName("Red"), 2.0F));
 		serieSD.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 				6, new Pen (Color.FromName("Black"), 2.0F));
 		serieJumps.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 				8, new Pen (Color.FromName("Blue"), 2.0F));
+				*/
 
 		//for the line between markers
 		serieAVG.SerieColor = Color.FromName("Red");
@@ -134,6 +136,7 @@ public class GraphRjAVGSD : StatRjAVGSD
 		}
 	}
 
+	/*
 	//overrided because SD have to be plot different (just in the top and down of AVG)	
 	protected override int plotGraphGraphSeries (IPlotSurface2D plot, int xtics, ArrayList allSeries)
 	{
@@ -227,6 +230,7 @@ public class GraphRjAVGSD : StatRjAVGSD
 
 		return acceptedSerie; //for knowing if a serie was accepted, and then createAxisGraphSeries
 	}
+*/
 
 	private double[] convertLineDataToSDData(double[] lineData, ArrayList serieSDData, bool up) {
 		double[] lineDataReturn = new double[ lineData.Length ];
diff --git a/src/stats/graphs/rjEvolution.cs b/src/stats/graphs/rjEvolution.cs
index e7cf853..0f46306 100644
--- a/src/stats/graphs/rjEvolution.cs
+++ b/src/stats/graphs/rjEvolution.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -113,13 +113,15 @@ public class GraphRjEvolution : StatRjEvolution
 			myColor = Color.FromName(Constants.Colors[countSeriesGraphColors]);
 			countSeriesGraphColors ++;
 		}
-		
+	
+		/*	
 		//serieTc.SerieMarker = new Marker (Marker.MarkerType.TriangleDown, 
 		serieTc.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 				6, new Pen (myColor, 2.0F));
 		//serieTv.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 		serieTv.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 				6, new Pen (myColor, 2.0F));
+				*/
 		
 		//for the line between markers
 		serieTc.SerieColor = myColor;
diff --git a/src/stats/graphs/rjIndex.cs b/src/stats/graphs/rjIndex.cs
index ad52890..26ed06a 100644
--- a/src/stats/graphs/rjIndex.cs
+++ b/src/stats/graphs/rjIndex.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -82,6 +82,7 @@ public class GraphRjIndex : StatRjIndex
 			serieTv.IsLeftAxis = true;
 			serieFall.IsLeftAxis = false;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			//serieTc.SerieMarker = new Marker (Marker.MarkerType.TriangleDown, 
@@ -92,6 +93,7 @@ public class GraphRjIndex : StatRjIndex
 					6, new Pen (Color.FromName("Blue"), 2.0F));
 			serieFall.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 					6, new Pen (Color.FromName("Chocolate"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -185,8 +187,8 @@ public class GraphRjIndex : StatRjIndex
 				countSeriesGraphColors ++;
 			}
 			
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/rjPotencyBosco.cs b/src/stats/graphs/rjPotencyBosco.cs
index cbb436e..33aad3d 100644
--- a/src/stats/graphs/rjPotencyBosco.cs
+++ b/src/stats/graphs/rjPotencyBosco.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -90,6 +90,7 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 			serieTime.IsLeftAxis = false;
 			serieFall.IsLeftAxis = false;
 
+			/*
 			serieIndex.SerieMarker = new Marker (Marker.MarkerType.Square, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
 			//serieTc.SerieMarker = new Marker (Marker.MarkerType.TriangleDown, 
@@ -104,6 +105,7 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 					6, new Pen (Color.FromName("Black"), 2.0F));
 			serieFall.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 					6, new Pen (Color.FromName("Chocolate"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieIndex.SerieColor = Color.FromName("Red");
@@ -214,8 +216,8 @@ public class GraphRjPotencyBosco : StatRjPotencyBosco
 				countSeriesGraphColors ++;
 			}
 			
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 			
 			mySerie.SerieColor = myColor;
 			
diff --git a/src/stats/graphs/sjCmjAbk.cs b/src/stats/graphs/sjCmjAbk.cs
index 7aa5381..b8b8452 100644
--- a/src/stats/graphs/sjCmjAbk.cs
+++ b/src/stats/graphs/sjCmjAbk.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -72,11 +72,13 @@ public class GraphSjCmjAbk : StatSjCmjAbk
 			serieTv.IsLeftAxis = true;
 			serieHeight.IsLeftAxis = false;
 
+			/*
 			//serieTv.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieTv.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
 			serieHeight.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Red"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieTv.SerieColor = Color.FromName("Blue");
@@ -96,6 +98,10 @@ public class GraphSjCmjAbk : StatSjCmjAbk
 			}
 			CurrentGraphData.LabelRight = "";
 		}
+
+		//CurrentGraphData.GraphType = myStatTypeStruct.GraphType;
+		//CurrentGraphData.GraphPalette = myStatTypeStruct.GraphPalette;
+		//CurrentGraphData.GraphTransposed = myStatTypeStruct.GraphTransposed;
 	}
 
 	protected override void printData (string [] statValues) 
@@ -154,9 +160,8 @@ public class GraphSjCmjAbk : StatSjCmjAbk
 				countSeriesGraphColors ++;
 			}
 		
-			//mySerie.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 
 			mySerie.SerieColor = myColor;
 
diff --git a/src/stats/graphs/sjCmjAbkPlus.cs b/src/stats/graphs/sjCmjAbkPlus.cs
index 543cbc6..3aa1a52 100644
--- a/src/stats/graphs/sjCmjAbkPlus.cs
+++ b/src/stats/graphs/sjCmjAbkPlus.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using Mono.Unix;
@@ -68,14 +68,21 @@ public class GraphSjCmjAbkPlus : StatSjCmjAbkPlus
 			serieHeight = new GraphSerie();
 			serieWeight = new GraphSerie();
 				
+			string weightName = Catalog.GetString("Weight");
+		
+			if(weightPercentPreferred)
+				weightName += " %";
+			else
+				weightName += " Kg";
 			serieTv.Title = Catalog.GetString("TF");
 			serieHeight.Title = Catalog.GetString("Height");
-			serieWeight.Title = Catalog.GetString("Weight");
+			serieWeight.Title = weightName;
 			
 			serieTv.IsLeftAxis = true;
 			serieHeight.IsLeftAxis = false;
 			serieWeight.IsLeftAxis = false;
 
+			/*
 			//serieTv.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
 			serieTv.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
 					6, new Pen (Color.FromName("Blue"), 2.0F));
@@ -83,6 +90,7 @@ public class GraphSjCmjAbkPlus : StatSjCmjAbkPlus
 					6, new Pen (Color.FromName("Green"), 2.0F));
 			serieWeight.SerieMarker = new Marker (Marker.MarkerType.Cross2, 
 					6, new Pen (Color.FromName("Chocolate"), 2.0F));
+					*/
 		
 			//for the line between markers
 			serieTv.SerieColor = Color.FromName("Blue");
@@ -105,6 +113,10 @@ public class GraphSjCmjAbkPlus : StatSjCmjAbkPlus
 			}
 			CurrentGraphData.LabelRight = "";
 		}
+		
+		//CurrentGraphData.GraphType = myStatTypeStruct.GraphType;
+		//CurrentGraphData.GraphPalette = myStatTypeStruct.GraphPalette;
+		//CurrentGraphData.GraphTransposed = myStatTypeStruct.GraphTransposed;
 	}
 
 	protected override void printData (string [] statValues) 
@@ -169,9 +181,8 @@ public class GraphSjCmjAbkPlus : StatSjCmjAbkPlus
 				countSeriesGraphColors ++;
 			}
 		
-			//mySerie.SerieMarker = new Marker (Marker.MarkerType.TriangleUp, 
-			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
-					6, new Pen (myColor, 2.0F));
+//			mySerie.SerieMarker = new Marker (Marker.MarkerType.Cross1, 
+//					6, new Pen (myColor, 2.0F));
 
 			mySerie.SerieColor = myColor;
 
diff --git a/src/stats/main.cs b/src/stats/main.cs
index 1170783..3a5acc8 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -23,8 +23,8 @@ using System.Data;
 using Gtk;
 using System.Collections; //ArrayList
 
-using NPlot.Gtk;
-using NPlot;
+//using NPlot.Gtk;
+//using NPlot;
 using System.Drawing;
 using System.Drawing.Imaging;
 using System.IO; 	//TextWriter
@@ -73,6 +73,8 @@ public class Stat
 	protected ArrayList markedRows;
 	private ArrayList personsWithData; //useful for selecting only people with data on comboCheckboxes
 
+	protected GraphROptions gRO;
+
 	protected bool toReport = false;
 	protected string reportString;
 
@@ -114,6 +116,7 @@ public class Stat
 		
 		this.markedRows = myStatTypeStruct.MarkedRows;
 		
+		this.gRO = myStatTypeStruct.GRO;
 		this.toReport = myStatTypeStruct.ToReport;
 		
 		this.treeview = treeview;
@@ -489,7 +492,7 @@ public class Stat
 
 		//removes persons in personsWithData
 		personsWithData = new ArrayList();
-
+	
 		//process all SQL results line x line
 		for (i=0; i < arrayFromSql.Count ; i ++) {
 			rowFromSql = arrayFromSql[i].ToString().Split(new char[] {':'});
@@ -866,7 +869,8 @@ public class Stat
 	//protected ArrayList onlyUsefulForNotBeingGarbageCollected = new ArrayList(); 
 	//has to be static
 	protected static ArrayList onlyUsefulForNotBeingGarbageCollected = new ArrayList(); 
-	
+
+	/*	
 	private Grid addGrid() 
 	{
 		Grid myGrid = new Grid();
@@ -877,6 +881,7 @@ public class Stat
 		myGrid.MajorGridPen = majorGridPen;
 		return myGrid;
 	}
+	*/
 
 	/*
 	   //nplot will be converted to R
@@ -970,131 +975,338 @@ public class Stat
 	}
 	*/
 
-	//currently only creates one customized graph	
-	public bool CreateGraphR (string fileName, bool show) 
+/* R TESTS */
+		/*
+		   if there's lot of data of only one variable:
+		   dotchart(data, cex=.5)
+		   */
+
+		/*
+		   xy graphs like this:
+		   rang <- c(1:length(rownames(data)))
+		   plot(dataDF$TC, dataDF$TV, pch=rang, col=rang)
+		   legend(75,150 ,legend=rownames(data), pch=rang, col=rang, cex=.5)
+		   */
+
+		/*
+		   two series of person X 4 jumpTypes
+
+		   NEED TO ADJUST INITAL-END X on xaxis
+
+		   serie0=c(.3, .5, .55, .6)
+		   serie1=c(.32, .52, .55, .62)
+		   maxVal=max(serie0,serie1)
+		   people=c("joan", "pep")
+		   jumpTypes=c("sj","Rocket","ABK","Free")
+
+		   xNames = jumpTypes
+		   legendNames = people
+
+		   colors=rainbow(length(legendNames))
+		   plot(serie0,xlim=c(0,length(xNames)+1), ylim=c(0,maxVal), pch=1, axes=FALSE, col=colors[1])
+		   points(serie1, pch=2, col=colors[2])
+		   axis(1, 1:4, xNames)
+		   axis(2)
+		   legend("topright", legend=legendNames, pch=c(1,2), cex=.5, col=colors)
+		   
+		   ---------------------
+		   (transposed) two series of jumpTypes X 2 persons
+		   best see how to transpose automatically
+
+		   serie0=c(.3, .32)
+		   serie1=c(.5, .52)
+		   serie2=c(.55, .55)
+		   serie3=c(.6, .62)
+		   maxVal=max(serie0,serie1,serie2,serie3)
+		   people=c("joan", "pep")
+		   jumpTypes=c("sj","Rocket","ABK","Free")
+
+		   xNames = people
+		   legendNames = jumpTypes
+
+		   colors=topo.colors(length(legendNames))
+		   plot(serie0,xlim=c(0,length(xNames)+1), ylim=c(0,maxVal), pch=1, axes=FALSE, col=colors[1])
+		   points(serie1, pch=2, col=colors[2])
+		   points(serie2, pch=3, col=colors[3])
+		   points(serie3, pch=4, col=colors[4])
+		   axis(1, 1:2, xNames)
+		   axis(2)
+		   legend("topright", legend=legendNames, pch=c(1:4), cex=.5, col=colors)
+
+		   ----------------------------------
+		   nicer, with table
+
+		   serie0=c(.3, .5, .55, .6)
+		   serie1=c(.32, .52, .55, .62)
+		   table <- rbind(serie0, serie1)
+		   maxVal=max(table)
+		   rownames(table)=c("joan", "pep")
+		   colnames(table)=c("sj","Rocket","ABK","Free")
+
+		#if transpose uncomment this:
+		#table <-t(table)
+
+		   colors=topo.colors(length(rownames(table)))
+		   plot(table[1,1:length(colnames(table))],xlim=c(0,length(colnames(table))+1), ylim=c(0,maxVal), pch=1, axes=FALSE, col=colors[1])
+		   for(i in 2:length(rownames(table))) 
+		   	points(table[i,1:length(colnames(table))], pch=i, col=colors[i])
+		  
+		   axis(1, 1:length(colnames(table)), colnames(table))
+		   axis(2)
+		   legend("bottomright", legend=rownames(table), pch=c(1:length(rownames(table))), cex=.5, col=colors)
+
+		   */
+
+
+
+
+		/* 
+		interessant:
+		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()
 	{
-		//only graph if there's data
-		//TODO: check also later if none row is selected
-		if(CurrentGraphData.XAxisNames.Count == 0) {
-			return false;
+		bool left = false;
+		bool right = false;
+		foreach(GraphSerie serie in GraphSeries) {
+			if(serie.IsLeftAxis)
+				left=true;
+			else
+				right=true;
 		}
-		if (!show) { //report
-			/*
-			string directoryName = Util.GetReportDirectoryName(ileName);
-			string [] pngs = Directory.GetFiles(directoryName, "*.png");
+		return (left && right);
+	}
 
-			//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";
-			*/
-		}
-		
-		ArrayList data = new ArrayList(1);
+	private string convertDataToR(GraphROptions gro, Sides side) 
+	{
 		string rD = ""; //rDataString
 		string bD = "data <- cbind("; //bindDataString
 		string colNamesD = "colnames(data) <- c("; //colNamesDataString
 		string sepSerie = "";
-		int count = 0;
+		int count = 0; //this counts accepted series
 		foreach(GraphSerie serie in GraphSeries) {
+			if(
+					side == Sides.LEFT && ! serie.IsLeftAxis ||
+					side == Sides.RIGHT && serie.IsLeftAxis) {
+				continue;
+			}
+			//on XY only take two vars
+			Log.WriteLine("groVarX: " + gro.VarX + " groVarY: " + gro.VarY + " tit: " + serie.Title);
+			if(gro.Type == Constants.GraphTypeXY &&
+					(gro.VarX != serie.Title && gro.VarY != serie.Title) ) {
+				Log.WriteLine("break");
+				continue;
+			}
+			else
+				Log.WriteLine("NO break");
+
+
 			rD += "serie" + count.ToString() + " <- c(";
 			string sep = "";
+			int count2=0;
 			foreach(string val in serie.SerieData) {
+				if(! acceptCheckedData(count2++))
+					continue;
 				if(val == "-")
 					rD += sep + "0";
 				else
-					if(serie.IsLeftAxis)
-						rD += sep + Util.ConvertToPoint(Convert.ToDouble(val)*100); //normally tc, tf from 0 to 1
-					else
-						rD += sep + Util.ConvertToPoint(val);
+					rD += sep + Util.ConvertToPoint(val);
 				sep = ", ";
 			}
 			rD += ")\n";
-
 			bD += sepSerie + "serie" + count.ToString();
-			if(serie.IsLeftAxis)
-				colNamesD += sepSerie + "'" + serie.Title + " [*100]'";
-			else
-				colNamesD += sepSerie + "'" + serie.Title + "'";
+			colNamesD += sepSerie + "'" + serie.Title  + "'";
 			sepSerie = ", ";
 			count ++;
 		}
-			
+
 		bD += ")\n";
 		colNamesD += ")\n";
 
-		
 		string rowNamesD = "rownames(data) <- c("; //rowNamesDataString
 		string sep2 = "";
 		for(int i=0; i < CurrentGraphData.XAxisNames.Count; i++) {
+			if(! acceptCheckedData(i))
+				continue;
 			rowNamesD += sep2 + "'" + CurrentGraphData.XAxisNames[i] + "'";
 			sep2 = ", ";
 		}
 		rowNamesD += ")\n";
 		
-			
-			
 		string allData = rD + bD + colNamesD + rowNamesD + "data\n";
-		allData += "dataT <- t(data)\n";
+		if(gro.Transposed)
+			allData += "data <- t(data)\n";
+	
+		return allData;	
+	}
 
+	private string getRBarplotString(GraphROptions gro, string fileName, Sides side) {
+		string allData = convertDataToR(gro, side);
+		string rG = //rGraphString
+			"barplot(data, beside=T, col=" + gro.Palette + "(length(rownames(data))), las=2)\n" +
+			" legend('" + gro.Legend +"', legend=rownames(data), cex=.7)\n" +
+			"title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
+
+		return allData + rG;
+	}
 
-		fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
 
+	private string getRLinesString(GraphROptions gro, string fileName, Sides side) {
+		string allData = convertDataToR(gro, side);
+		string axesStr = " axis(2)\n";
+		if(side == Sides.RIGHT)
+			axesStr = " axis(4)\n";
 		string rG = //rGraphString
-			"png(filename = '" + fileName + "', width = 670, height = 400, units = 'px',\n" +
-		        " pointsize = 12, bg = 'white', res = NA)\n"+
-			"barplot(dataT, beside=T, legend=rownames(dataT), col=rainbow(length(rownames(dataT))), las=2)\n" +
-			"title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n" +
-			"dev.off()";
+		   	" colors=" + gro.Palette +"(length(rownames(data)))\n" +
+		   	" plot(data[1,1:length(colnames(data))], type='b', xlim=c(0,length(colnames(data))+1), ylim=c(min(data),max(data)), pch=1, axes=FALSE, col=colors[1])\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=colors[i])\n" +
+			" }\n" +
+			" axis(1, 1:length(colnames(data)), colnames(data), las=2)\n" +
+			axesStr + 
+			" legend('" + gro.Legend +"', legend=rownames(data), pch=c(1:length(rownames(data))), cex=.7, col=colors)\n" +
+			" title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
+
+		return allData + rG;
+	}
+	
+	private string getRXYString(GraphROptions gro, string fileName) {
+		string allData = convertDataToR(gro, Sides.ALL);
+		string rG = //rGraphString
+			"rang <- c(1:length(rownames(data)))\n" +
+			"plot(serie0, serie1, pch=rang, col=rang)\n" +
+			"legend('" + gro.Legend +"' ,legend=rownames(data), pch=rang, col=rang, cex=.7)\n" +
+			"title(main='" + CurrentGraphData.GraphTitle + "', sub='testing', cex.sub=0.75, font.sub=3, col.sub='red')\n";
 
-		/*
-		   if there's lot of data of only one variable:
-		   dotchart(data, cex=.5)
-		   */
+		return allData + rG;
+	}
 
-		/*
-	> 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')
-	*/
+	private string getRDotchartString(GraphROptions gro, string fileName) {
+		return "";
+	}
 
-		/*
-		   > 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))
-		   */
+	public enum Sides { ALL, LEFT, RIGHT };
+
+	//currently only creates one customized graph	
+	public bool CreateGraphR (string fileName, bool show) 
+	{
+		//only graph if there's data
+		//TODO: check also later if none row is selected
+		if(CurrentGraphData.XAxisNames.Count == 0) {
+			return false;
+		}
+		if (!show) { //report
+			/*
+			string directoryName = Util.GetReportDirectoryName(ileName);
+			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 = System.IO.Path.Combine(Path.GetTempPath(), fileName); 
+	
+		string rString = "png(filename = '" + fileName + "'\n" + 
+			" , width = " + gRO.Width + ", height = " + gRO.Height + ", units = 'px'\n" +
+			" , pointsize = 12, bg = 'white', res = NA)\n";
+
+		if(gRO.Type == Constants.GraphTypeBarplot) {
+			if(hasTwoAxis()) {
+				rString += "par(mfrow=c(1,2))\n";
+				rString += getRBarplotString(
+						gRO, fileName, Sides.LEFT);
+				rString += getRBarplotString(
+						gRO, fileName, Sides.RIGHT);
+			}
+			else
+				rString += getRBarplotString(
+						gRO, fileName, Sides.ALL);
+		}
+		else if(gRO.Type == Constants.GraphTypeLines) {
+			if(hasTwoAxis()) {
+				rString += "par(mfrow=c(1,2))\n";
+				rString += getRLinesString(
+						gRO, fileName, Sides.LEFT);
+				rString += getRLinesString(
+						gRO, fileName, Sides.RIGHT);
+			}
+			else
+				rString += getRLinesString(
+						gRO, fileName, Sides.ALL);
+		}
+		else if(gRO.Type == Constants.GraphTypeXY)
+			rString += getRXYString(gRO, fileName);
+		else //if(CurrentGraphData.GraphType == Constants.GraphTypeDotchart))
+			rString += getRDotchartString(gRO, fileName);
+		//TODO: 
+		//- do XY with two variables (on sjCmjABKPlus select if graph tv or height)
+		//- if is not transposed, then always? legend appears two times and is the same. Plot legend on "MY BIG MAIN TITLE" graph
+
+
+		//have an unique title for both graphs
+		if(hasTwoAxis() && gRO.Type != Constants.GraphTypeXY)
+			rString += "par(mfrow=c(1,1), new=TRUE)\n" +
+				"plot(-1, axes=FALSE)\n" +
+				"title(main='MY BIG MAIN TITLE')\n" +
+				"par(mfrow=c(1,1), new=FALSE)\n";
+		
+		rString += " dev.off()\n";
 
+		fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
 
 		string rScript = System.IO.Path.Combine(Path.GetTempPath(), Constants.FileNameRScript);
 		TextWriter writer = File.CreateText(rScript);
-		writer.Write(allData + rG);
+		writer.Write(rString);
 		writer.Flush();
 		((IDisposable)writer).Dispose();
 		
 		Process r = Process.Start("R CMD BATCH " + rScript);
 		r.WaitForExit();
-		
-		if(show)
-			new DialogImageTest("prueba de graph con R", fileName);
+
+		if(show) {
+			if(! File.Exists(fileName) || File.GetLastWriteTime(fileName) < File.GetLastWriteTime(rScript))
+				new DialogMessage(Constants.MessageTypes.WARNING, "Sorry. Error doing graph");
+			else
+				new DialogImageTest("prueba de graph con R", fileName);
+		}
 
 		return true;
 	}
 			
-			
+		
+	/*	
 	private int getSizeX() {
 		int x;
 		int xMultiplier = 50;
@@ -1134,6 +1346,7 @@ public class Stat
 		
 		return y;
 	}
+	*/
 
 
 	/*
@@ -1184,7 +1397,8 @@ public class Stat
 		}
 		return false;
 	}
-	
+
+	/*	
 	//used only by RjEvolution in plotGraphGraphSeries, 
 	//because rjevolution has a serie for TC and a serie for TF for each jumper
 	int divideAndRoundDown (int myData) {
@@ -1197,7 +1411,9 @@ public class Stat
 			return Convert.ToInt32(myData/2);
 		}
 	}
-	
+	*/
+
+	/*	
 	protected virtual int plotGraphGraphSeries (IPlotSurface2D plot, int xtics, ArrayList allSeries)
 	{
 		rjEvolutionMaxJumps = -1;
@@ -1292,7 +1508,7 @@ public class Stat
 				plot.Add( pp, NPlot.PlotSurface2D.XAxisPosition.Bottom, NPlot.PlotSurface2D.YAxisPosition.Right );
 			}
 				
-			/* plot AVG */
+			// plot AVG 
 			if(mySerie.Avg != 0) {
 				HorizontalLine hl1 = new HorizontalLine(mySerie.Avg, mySerie.SerieColor);
 				//Log.WriteLine("serie.AVG: {0}", mySerie.Avg);
@@ -1312,7 +1528,9 @@ public class Stat
 		}
 		return acceptedSerie; //for knowing if a serie was accepted, and then createAxisGraphSeries
 	}
-		
+	*/
+
+	/*
 	protected void createAxisGraphSeries (IPlotSurface2D plot, GraphData graphData)
 	{
 		LabelAxis la = new LabelAxis( plot.XAxis1 );
@@ -1379,7 +1597,7 @@ public class Stat
 		plot.Legend = new Legend();
 		plot.Legend.XOffset = +30;
 	}
-	
+	*/	
 
 	public ArrayList Sessions {
 		get { return sessions; }
diff --git a/src/stats/sjCmjAbkPlus.cs b/src/stats/sjCmjAbkPlus.cs
index 8aa293b..1313435 100644
--- a/src/stats/sjCmjAbkPlus.cs
+++ b/src/stats/sjCmjAbkPlus.cs
@@ -32,7 +32,7 @@ public class StatSjCmjAbkPlus : Stat
 	
 	//if this is not present i have problems like (No overload for method `xxx' takes `0' arguments) with some inherited classes
 	
-	private bool weightPercentPreferred;
+	protected bool weightPercentPreferred;
 
 	public StatSjCmjAbkPlus () 
 	{
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index a04380c..d285d92 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -133,6 +133,19 @@ public class UtilGtk
 		myCol.SortIndicator = true;
 		tv.AppendColumn ( myCol );
 	}
+	
+	public static string [] GetCols(Gtk.TreeView tv, int first) {
+		Gtk.TreeViewColumn [] cols = tv.Columns;
+		string [] colNames = new String [cols.Length];
+		int i=0;
+		foreach (Gtk.TreeViewColumn col in cols) {
+			if(i >= first)
+				colNames[i] = col.Title;
+			i++;
+		}
+		return colNames;
+	}
+
 
 	public static int IdColumnCompare (TreeModel model, TreeIter iter1, TreeIter iter2)     {
 		int val1 = 0;



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