[chronojump] report works with R graphs now, done dotchart, boxplot
- From: Xavier de Blas <xaviblas src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [chronojump] report works with R graphs now, done dotchart, boxplot
- Date: Wed, 2 Sep 2009 15:06:29 +0000 (UTC)
commit e60f531803f5ff4b056b05ad7766d49e70e6bece
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Sep 2 17:05:14 2009 +0200
report works with R graphs now, done dotchart, boxplot
done avg on xy and avg, median on dotchart
fixed bug: on session load/new, statistics of other sessions are deleted from report (they show before the other sesssion stat)
TODO.txt | 5 +-
chronojump_server/bin/chronojumpServer.dll | Bin 272384 -> 272384 bytes
src/constants.cs | 4 +-
src/gui/chronojump.cs | 8 +
src/gui/report.cs | 22 +-
src/gui/stats.cs | 50 ++++--
src/report.cs | 23 +--
src/statType.cs | 7 +-
src/stats/graphs/graphROptions.cs | 17 ++
src/stats/main.cs | 301 +++++++---------------------
src/utilGtk.cs | 11 +
11 files changed, 169 insertions(+), 279 deletions(-)
---
diff --git a/TODO.txt b/TODO.txt
index 99eecbf..7368469 100644
--- a/TODO.txt
+++ b/TODO.txt
@@ -1,9 +1,10 @@
TODO:
do multisession graphs
-fix global, jumper, rjEvolution
+do multisession
+do stripchart
continue with titles and subtitles for all graphs
-do report graphs
+fix global, jumper, rjEvolution
check all software (for the Util.TrimDecimals change)
create accept license on uploading
diff --git a/chronojump_server/bin/chronojumpServer.dll b/chronojump_server/bin/chronojumpServer.dll
index 3141929..a6d2e16 100755
Binary files a/chronojump_server/bin/chronojumpServer.dll and b/chronojump_server/bin/chronojumpServer.dll differ
diff --git a/src/constants.cs b/src/constants.cs
index dda696f..2c75103 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -236,12 +236,12 @@ public class Constants
public static string FileNameRGraph = "r-graph.png";
public static string FileNameRScript = "r-graph.txt";
+ public static string GraphTypeBoxplot = "Boxplot";
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 [] GraphTypes = { GraphTypeBoxplot, GraphTypeBarplot, GraphTypeLines, GraphTypeXY, GraphTypeDotchart };
public static string [] GraphPalettes = { "rainbow", "heat.colors", "gray.colors", "topo.colors" };
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index f8299fd..cfa4714 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -2015,6 +2015,10 @@ public class ChronoJumpWindow
//update report
report.SessionID = currentSession.UniqueID;
+ report.StatisticsRemove();
+ try {
+ reportWin.FillTreeView();
+ } catch {} //reportWin is still not created, not need to Fill again
//feedback (more in 1st session created)
string feedbackLoadUsers = Catalog.GetString ("Session created, now add or load persons.");
@@ -2082,6 +2086,10 @@ public class ChronoJumpWindow
//update report
report.SessionID = currentSession.UniqueID;
+ report.StatisticsRemove();
+ try {
+ reportWin.FillTreeView();
+ } catch {} //reportWin is still not created, not need to Fill again
}
diff --git a/src/gui/report.cs b/src/gui/report.cs
index 36b0eb1..2c98694 100644
--- a/src/gui/report.cs
+++ b/src/gui/report.cs
@@ -74,7 +74,7 @@ public class ReportWindow {
//treeview
createTreeView(treeview1);
store = new TreeStore( typeof (string), typeof (string), typeof (string),
- typeof (string), typeof (string), typeof (string), typeof (string)
+ typeof (string), typeof (string), typeof (string), typeof (string), typeof (string)
);
treeview1.Model = store;
@@ -94,7 +94,7 @@ public class ReportWindow {
//checkboxes
ReportWindowBox.loadCheckBoxes();
- ReportWindowBox.fillTreeView();
+ ReportWindowBox.FillTreeView();
ReportWindowBox.report_window.Show ();
}
@@ -105,7 +105,7 @@ public class ReportWindow {
//checkboxes
ReportWindowBox.loadCheckBoxes();
- ReportWindowBox.fillTreeView();
+ ReportWindowBox.FillTreeView();
ReportWindowBox.report_window.Show ();
}
@@ -129,6 +129,7 @@ public class ReportWindow {
tv.AppendColumn ( Catalog.GetString("Show jumps"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("Show sex"), new CellRendererText(), "text", count++);
tv.AppendColumn ( Catalog.GetString("Checked rows"), new CellRendererText(), "text", count++);
+ tv.AppendColumn ( Catalog.GetString("Graph Options"), new CellRendererText(), "text", count++);
}
void loadCheckBoxes ()
@@ -145,13 +146,12 @@ public class ReportWindow {
if(report.ShowPulses) { cb_pulses.Active = true; }
}
- void fillTreeView ()
+ public void FillTreeView ()
{
//delete rows
store.Clear();
for (int i=0; i < report.StatisticsData.Count ; i++) {
- //string [] myStringFull = report.StatisticsData[i].ToString().Split(new char[] {'\n'});
string [] myStringFull = report.StatisticsData[i].ToString().Split(new char[] {'\t'});
store.AppendValues (
@@ -161,7 +161,8 @@ public class ReportWindow {
myStringFull[3], //sessionString
myStringFull[4], //showJumps
myStringFull[5], //showSex
- myStringFull[6] //markedRows
+ myStringFull[6], //markedRows
+ myStringFull[7] //graphROptions
);
}
@@ -180,9 +181,8 @@ public class ReportWindow {
}
//comes from stats window
- //public void Add(string type, string subtype, string applyTo, string sessionString, string showJumps, string showSex)
public void Add(string type, string subtype, string applyTo, ArrayList sendSelectedSessions,
- string showJumps, string showSex, ArrayList markedRows)
+ string showJumps, string showSex, ArrayList markedRows, GraphROptions gro)
{
string sessionsAsAString = arrayToString(sendSelectedSessions);
string markedRowsAsAString = arrayToString(markedRows);
@@ -194,7 +194,8 @@ public class ReportWindow {
sessionsAsAString,
showJumps,
showSex,
- markedRowsAsAString
+ markedRowsAsAString,
+ gro.ToString()
);
//show report window if it's not shown
@@ -339,7 +340,8 @@ public class ReportWindow {
(string) treeview1.Model.GetValue (myIter, 3) + "\t" + //sessionString
(string) treeview1.Model.GetValue (myIter, 4) + "\t" + //showJumps
(string) treeview1.Model.GetValue (myIter, 5) + "\t" + //showSex
- (string) treeview1.Model.GetValue (myIter, 6) //markedRowsString
+ (string) treeview1.Model.GetValue (myIter, 6) + "\t" + //markedRowsString
+ (string) treeview1.Model.GetValue (myIter, 7) //GraphROptions
);
}
}
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 66a4961..7e96ff5 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -244,6 +244,9 @@ public class StatsWindow {
spinbutton_mark_consecutives.Sensitive = false;
hbox_mark_consecutives.Hide();
+
+ //first graph type is boxplot, and it doesn't show transpose
+ showTransposed(false);
}
@@ -410,20 +413,29 @@ public class StatsWindow {
combo_graph_legend.Sensitive = true;
}
+ private void showTransposed(bool show) {
+ label_graph_options.Visible = show;
+ checkbutton_transposed.Visible = show;
+ }
+
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;
+ showTransposed(!show);
}
private void on_combo_graph_type_changed(object o, EventArgs args) {
- if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
+ if(
+ UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeDotchart ||
+ UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeBoxplot)
+ showTransposed(false);
+ else if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeXY)
showGraphXYStuff(true);
else
showGraphXYStuff(false);
+
}
private void on_combo_select_checkboxes_changed(object o, EventArgs args) {
@@ -588,6 +600,25 @@ public class StatsWindow {
//ShowUpdateStatsButton();
}
+ //creates a GraphROptions object
+ public GraphROptions fillGraphROptions() {
+ //Dotchart plots col 2
+ string varx = UtilGtk.ComboGetActive(combo_graph_var_x);
+ if(UtilGtk.ComboGetActive(combo_graph_type) == Constants.GraphTypeDotchart)
+ varx = UtilGtk.GetCol(treeview_stats, 2);
+
+ return new GraphROptions(
+ UtilGtk.ComboGetActive(combo_graph_type),
+ varx,
+ 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)
+ );
+ }
+
private bool fillTreeView_stats (bool graph)
{
if(blockFillingTreeview)
@@ -647,16 +678,7 @@ public class StatsWindow {
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)
- );
+ GraphROptions graphROptions = fillGraphROptions();
myStatType = new StatType(
statisticType,
@@ -1118,7 +1140,7 @@ public class StatsWindow {
reportWin.Add(statisticType, statisticSubType, statisticApplyTo,
//sessionsAsAString, statsShowJumps, showSex.ToString());
sendSelectedSessions, statsShowJumps, showSex.ToString(),
- myStatType.MarkedRows);
+ myStatType.MarkedRows, fillGraphROptions());
statusbar_stats.Push( 1, Catalog.GetString("Successfully added") + " " + statisticType + "-" + statisticSubType + "-" + statisticApplyTo);
diff --git a/src/report.cs b/src/report.cs
index 403b9fb..267ecdf 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -66,11 +66,12 @@ public class Report : ExportSession
spreadsheetString = "";
- StatisticsData = new ArrayList(2);
+ StatisticsData = new ArrayList(1);
mySession = SqliteSession.Select(sessionID.ToString());
}
-
+
+/*
public Report(int sessionID, bool showCurrentSessionData, bool showCurrentSessionJumpers,
bool showSimpleJumps, bool showReactiveJumps, bool showSimpleRuns, bool showIntervalRuns,
bool showReactionTimes, bool showPulses, ArrayList statisticsData)
@@ -90,11 +91,17 @@ public class Report : ExportSession
mySession = SqliteSession.Select(sessionID.ToString());
}
+ */
public void PrepareFile () {
checkFile("report");
}
+ //when a session changes, remove all stats because in report they refer to previoud session
+ public void StatisticsRemove() {
+ StatisticsData = new ArrayList(1);
+ }
+
protected override void getData()
{
//create directory fileName_files/
@@ -361,17 +368,7 @@ 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
- );
+ GraphROptions graphROptions = new GraphROptions(strFull[7]);
myStatType = new StatType(
strFull[0], //statisticType
diff --git a/src/statType.cs b/src/statType.cs
index 58c0327..a5f0be7 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -216,9 +216,6 @@ public class StatType {
this.rj_evolution_mark_consecutives = rj_evolution_mark_consecutives;
- //this.graphType = graphType;
- //this.graphPalette = graphPalette;
- //this.graphTransposed = graphTransposed;
this.gRO = gRO;
this.graph = graph;
@@ -427,8 +424,8 @@ public class StatType {
if(toReport) {
if(graph) {
- //bool notEmpty = myStat.CreateGraphR(fileName, false); //dont' show
- //if(notEmpty) { linkImage(fileName); }
+ bool notEmpty = myStat.CreateGraphR(fileName, false); //dont' show
+ if(notEmpty) { linkImage(fileName); }
} else {
writer.WriteLine(myStat.ReportString());
}
diff --git a/src/stats/graphs/graphROptions.cs b/src/stats/graphs/graphROptions.cs
index fc98799..b4dc886 100644
--- a/src/stats/graphs/graphROptions.cs
+++ b/src/stats/graphs/graphROptions.cs
@@ -48,4 +48,21 @@ public class GraphROptions
}
public GraphROptions() {
}
+
+ //from report
+ public GraphROptions(string str) {
+ string [] strFull = str.Split(new char[] {':'});
+ this.Type = strFull[0];
+ this.VarX = strFull[1];
+ this.VarY = strFull[2];
+ this.Palette = strFull[3];
+ this.Transposed = Util.StringToBool(strFull[4]);
+ this.Width = Convert.ToInt32(strFull[5]);
+ this.Height = Convert.ToInt32(strFull[6]);
+ this.Legend = strFull[7];
+ }
+
+ public override string ToString() {
+ return Type + ":" + VarX + ":" + VarY + ":" + Palette + ":" + Transposed + ":" + Width + ":" + Height + ":" + Legend;
+ }
}
diff --git a/src/stats/main.cs b/src/stats/main.cs
index b6cd297..894c6fd 100644
--- a/src/stats/main.cs
+++ b/src/stats/main.cs
@@ -871,195 +871,8 @@ public class Stat
//has to be static
protected static ArrayList onlyUsefulForNotBeingGarbageCollected = new ArrayList();
- /*
- private Grid addGrid()
- {
- Grid myGrid = new Grid();
- myGrid.VerticalGridType = Grid.GridType.Coarse;
- Pen majorGridPen = new Pen( Color.LightGray );
- float[] pattern = {1.0f,2.0f};
- majorGridPen.DashPattern = pattern;
- myGrid.MajorGridPen = majorGridPen;
- return myGrid;
- }
- */
-
- /*
- //nplot will be converted to R
- public void CreateGraph ()
- {
- //only graph if there's data
- //TODO: check also later if none row is selected
- if(CurrentGraphData.XAxisNames.Count == 0) {
- return;
- }
-
- NPlot.Gtk.PlotSurface2D plot = new NPlot.Gtk.PlotSurface2D ();
-
- //create plot (same as below)
- plot.Clear();
-
- plot.Add(addGrid());
-
- plot.Title = CurrentGraphData.GraphTitle;
- int acceptedSeries = plotGraphGraphSeries (plot,
- CurrentGraphData.XAxisNames.Count + 2, //xtics (+2 for left, right space)
- GraphSeries);
- if(acceptedSeries == 0) { return; }
-
- createAxisGraphSeries (plot, CurrentGraphData);
-
- writeLegend(plot);
-
- //put in window
- //fixes a gtk# garbage collecting bug
- onlyUsefulForNotBeingGarbageCollected.Add(plot);
-
- plot.Show ();
-
- Gtk.Window w = new Window (CurrentGraphData.WindowTitle);
- //put an icon to window
- UtilGtk.IconWindowGraph(w);
-
- int x = getSizeX();
- int y = getSizeY(x, acceptedSeries);
- w.SetDefaultSize (x,y);
-
- w.Add (plot);
- w.ShowAll ();
- }
-
- //nplot will be converted to R
- public bool CreateGraph (string fileName)
- {
- //only graph if there's data
- //TODO: check also later if none row is selected
- if(CurrentGraphData.XAxisNames.Count == 0) {
- return false;
- }
-
- NPlot.PlotSurface2D plot = new NPlot.PlotSurface2D ();
-
- //create plot (same as above)
- plot.Clear();
-
- plot.Add(addGrid());
-
- plot.Title = CurrentGraphData.GraphTitle;
-
- int acceptedSeries = plotGraphGraphSeries (plot,
- CurrentGraphData.XAxisNames.Count + 2, //xtics (+2 for left, right space)
- GraphSeries);
- if(acceptedSeries == 0) { return false; }
-
- createAxisGraphSeries (plot, CurrentGraphData);
-
- writeLegend(plot);
-
- int x = getSizeX();
- int y = getSizeY(x, acceptedSeries);
- Bitmap b = new Bitmap (x, y);
- Graphics g = Graphics.FromImage (b);
- g.FillRectangle (Brushes.White, 0, 0, x, y);
- Rectangle bounds = new Rectangle (0, 0, x, y);
-
- //save to file
- plot.Draw (g, bounds);
- string directoryName = Util.GetReportDirectoryName(fileName);
- string [] pngs = Directory.GetFiles(directoryName, "*.png");
-
- //if found 3 images, sure will be 1.png, 2.png and 3.png, next will be 4.png
- //there will be always a png with chronojump_logo
- b.Save (directoryName + "/" + pngs.Length.ToString() + ".png", ImageFormat.Png);
-
- return true;
- }
- */
/* 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:
@@ -1067,8 +880,6 @@ public class Stat
*/
-
-
/*
> heights
[1] 0.30 0.50 0.55 0.60
@@ -1133,6 +944,10 @@ public class Stat
xyFirstFound = "y";
}
}
+
+ //Dotchart plots col 2
+ if(gro.Type == Constants.GraphTypeDotchart && gro.VarX != serie.Title)
+ continue;
rD += "serie" + count.ToString() + " <- c(";
@@ -1186,7 +1001,11 @@ public class Stat
string allData = rD + bD + colNamesD + rowNamesD + "data\n";
- if(gro.Transposed && gro.Type != Constants.GraphTypeXY)
+ if(gro.Transposed &&
+ gro.Type != Constants.GraphTypeXY &&
+ gro.Type != Constants.GraphTypeDotchart &&
+ gro.Type != Constants.GraphTypeBoxplot
+ )
allData += "data <- t(data)\n";
return allData;
@@ -1196,6 +1015,38 @@ public class Stat
return "title(main='" + CurrentGraphData.GraphTitle + " (" + graphType +")', sub='" +
CurrentGraphData.GraphSubTitle + "', cex.sub=0.75, font.sub=3, col.sub='grey30')\n";
}
+
+ private string getRBoxplotString(GraphROptions gro, string fileName, Sides side) {
+ string allData = convertDataToR(gro, side);
+
+ string ylabStr = "";
+ if(side == Sides.RIGHT) {
+ if(CurrentGraphData.LabelRight != "")
+ ylabStr = ", ylab='" + CurrentGraphData.LabelRight + "'";
+ }
+ else { //ALL or LEFT
+ if(CurrentGraphData.LabelLeft != "")
+ ylabStr = ", ylab='" + CurrentGraphData.LabelLeft + "'";
+ }
+
+ string rG = //rGraphString
+ "boxplot(as.data.frame(data), las=2, xlab=''" + ylabStr + ")\n" +
+ "axis(1, 1:length(colnames(data)), colnames(data), las=2)\n"; //axis separated from boxplot because if data hsa one col, names are not displayed
+
+ //have an unique title for both graphs
+ string titStr = getTitle("Boxplot");
+ if(hasTwoAxis()) {
+ if(side==Sides.RIGHT)
+ rG += "par(mfrow=c(1,1), new=TRUE)\n" +
+ "plot(-1, axes=FALSE, type='n', xlab='', ylab='')\n" +
+ titStr +
+ "par(mfrow=c(1,1), new=FALSE)\n";
+ } else
+ rG += titStr;
+
+ return allData + rG;
+ }
+
private string getRBarplotString(GraphROptions gro, string fileName, Sides side) {
string allData = convertDataToR(gro, side);
@@ -1277,6 +1128,7 @@ public class Stat
string rG = //rGraphString
"rang <- c(1:length(rownames(data)))\n" +
"plot(serie0, serie1, pch=rang, col=rang, xlab='" + gro.VarX + "', ylab='" + gro.VarY + "')\n" +
+ "abline(lm(serie0 ~ serie1),col='grey30')\n" +
"legend('" + gro.Legend +"' ,legend=rownames(data), pch=rang, col=rang, cex=.7)\n" +
titStr;
@@ -1284,7 +1136,17 @@ public class Stat
}
private string getRDotchartString(GraphROptions gro, string fileName) {
- return "";
+ string allData = convertDataToR(gro, Sides.ALL);
+ string titStr = getTitle("Dotchart");
+ string rG = //rGraphString
+ "dotchart(serie0, labels=rownames(data), cex=1)\n" +
+ "abline(v=mean(serie0), lty=1, col='grey20')\n" +
+ "abline(v=median(serie0), lty=2, col='grey50')\n" +
+ "mtext('avg', at=mean(serie0), side=1, cex=.7, col='grey20')\n" +
+ "mtext('median', at=median(serie0), side=1, cex=.7, col='grey50')\n" +
+ titStr;
+
+ return allData + rG;
}
public enum Sides { ALL, LEFT, RIGHT };
@@ -1303,7 +1165,7 @@ public class Stat
//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(directoryName, pngs.Length.ToString() + ".png");
} else
fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
@@ -1311,7 +1173,19 @@ public class Stat
" , width = " + gRO.Width + ", height = " + gRO.Height + ", units = 'px'\n" +
" , pointsize = 12, bg = 'white', res = NA)\n";
- if(gRO.Type == Constants.GraphTypeBarplot) {
+ if(gRO.Type == Constants.GraphTypeBoxplot) {
+ if(hasTwoAxis()) {
+ rString += "par(mfrow=c(1,2))\n";
+ rString += getRBoxplotString(
+ gRO, fileName, Sides.LEFT);
+ rString += getRBoxplotString(
+ gRO, fileName, Sides.RIGHT);
+ }
+ else
+ rString += getRBoxplotString(
+ gRO, fileName, Sides.ALL);
+ }
+ else if(gRO.Type == Constants.GraphTypeBarplot) {
if(hasTwoAxis()) {
rString += "par(mfrow=c(1,2))\n";
rString += getRBarplotString(
@@ -1342,7 +1216,7 @@ public class Stat
rString += " dev.off()\n";
- fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
+ //fileName = System.IO.Path.Combine(Path.GetTempPath(), fileName);
string rScript = System.IO.Path.Combine(Path.GetTempPath(), Constants.FileNameRScript);
TextWriter writer = File.CreateText(rScript);
@@ -1407,45 +1281,6 @@ public class Stat
*/
- /*
- * SAVED COMMENTED FOR HAVING A SAMPLE OF HISTOGRAMS
- *
- protected int plotGraphSimplesessionJumps(IPlotSurface2D plot, ArrayList myValues)
- {
- HistogramPlot hp = new HistogramPlot();
- hp.BaseWidth = 0.4f;
-
- int xtics = myValues.Count;
- double[] myData = new double[xtics];
-
- hp.Label = "TF (seconds)";
-
- int count=0;
- for(int i=0; i < myValues.Count ; i++) {
- string [] jump = myValues[i].ToString().Split(new char[] {':'});
-
- int j=0;
- foreach (string myValue in jump)
- {
- if(j>0) {
- myData[count] = Convert.ToDouble(myValue);
- //Log.WriteLine("count {0}, myData {1}", count, myData[count]);
- count ++;
- }
- j++;
- }
- }
- hp.DataSource = myData;
- hp.BrushOrientation = HistogramPlot.BrushOrientations.HorizontalFadeIn;
- hp.Filled = true;
-
- hp.Pen = Pens.Red;
- plot.Add(hp);
-
- //return the number of plotted bars
- return count;
- }
-*/
protected bool acceptCheckedData(int myData) {
foreach(string marked in markedRows) {
diff --git a/src/utilGtk.cs b/src/utilGtk.cs
index d285d92..91e7a56 100644
--- a/src/utilGtk.cs
+++ b/src/utilGtk.cs
@@ -145,6 +145,17 @@ public class UtilGtk
}
return colNames;
}
+
+ public static string GetCol(Gtk.TreeView tv, int colWanted) {
+ Gtk.TreeViewColumn [] cols = tv.Columns;
+ int i=0;
+ foreach (Gtk.TreeViewColumn col in cols)
+ if(i++ == colWanted)
+ return col.Title;
+
+ return "";
+ }
+
public static int IdColumnCompare (TreeModel model, TreeIter iter1, TreeIter iter2) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]