[chronojump] Added subtraction graphs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Added subtraction graphs
- Date: Tue, 22 Feb 2011 17:07:33 +0000 (UTC)
commit fccb2ed7152f2d83af384633dc641f910412c3f8
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Feb 22 15:58:31 2011 +0100
Added subtraction graphs
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/statType.cs | 3 +-
src/stats/graphs/jumpSimpleSubtraction.cs | 164 +++++++++++++++++++++++++++++
4 files changed, 167 insertions(+), 2 deletions(-)
---
diff --git a/po/POTFILES.in b/po/POTFILES.in
index ac2812a..e6e8433 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -65,6 +65,7 @@ src/stats/graphs/rjPotencyBosco.cs
src/stats/graphs/runSimple.cs
src/stats/graphs/sjCmjAbk.cs
src/stats/graphs/sjCmjAbkPlus.cs
+src/stats/graphs/jumpSimpleSubtraction.cs
src/stats/ieIub.cs
src/stats/jumpSimpleSubtraction.cs
src/stats/main.cs
diff --git a/src/Makefile.am b/src/Makefile.am
index 4196775..54d17db 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -132,6 +132,7 @@ FILES = \
stats/graphs/potency.cs\
stats/graphs/rjAVGSD.cs\
stats/graphs/runSimple.cs\
+ stats/graphs/jumpSimpleSubtraction.cs\
sqlite/main.cs\
sqlite/preferences.cs\
sqlite/session.cs\
diff --git a/src/statType.cs b/src/statType.cs
index 425da4b..7799093 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -261,8 +261,7 @@ public class StatType {
if(indexType == "subtraction") {
if(graph)
- //myStat = new GraphStatJumpSimpleSubtraction (myStatTypeStruct);
- myStat = new StatJumpSimpleSubtraction(myStatTypeStruct, treeview_stats);
+ myStat = new GraphJumpSimpleSubtraction(myStatTypeStruct);
else
myStat = new StatJumpSimpleSubtraction(myStatTypeStruct, treeview_stats);
} else if(indexType == "IE" || indexType == "IUB") {
diff --git a/src/stats/graphs/jumpSimpleSubtraction.cs b/src/stats/graphs/jumpSimpleSubtraction.cs
new file mode 100644
index 0000000..5fe9796
--- /dev/null
+++ b/src/stats/graphs/jumpSimpleSubtraction.cs
@@ -0,0 +1,164 @@
+/*
+ * 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
+ *
+ * Copyright (C) 2004-2009 Xavier de Blas <xaviblas gmail com>
+ */
+
+using System;
+using System.Data;
+using Gtk;
+using System.Collections; //ArrayList
+using System.Drawing;
+using System.Drawing.Imaging;
+using Mono.Unix;
+
+
+public class GraphJumpSimpleSubtraction : StatJumpSimpleSubtraction
+{
+ protected string operation;
+
+ //for simplesession
+ GraphSerie serieIndex;
+ GraphSerie serieJump1;
+ GraphSerie serieJump2;
+
+ public GraphJumpSimpleSubtraction (StatTypeStruct myStatTypeStruct)
+ {
+ completeConstruction (myStatTypeStruct, treeview);
+
+ this.dataColumns = 3; //for Simplesession (index, test1, test2)
+
+ string [] applyTos = myStatTypeStruct.StatisticApplyTo.Split(new char[] {':'});
+ test1 = applyTos[0];
+ test2 = applyTos[1];
+
+ columnsString[0] = "Jumper";
+ columnsString[1] = Catalog.GetString("Result");
+ columnsString[2] = test1;
+ columnsString[3] = test2;
+
+ if (statsJumpsType == 2) {
+ this.operation = "MAX";
+ } else {
+ this.operation = "AVG";
+ }
+
+ CurrentGraphData.WindowTitle = Catalog.GetString("ChronoJump graph");
+ //title is shown on the graph except it's a report, then title will be on the html
+ if(myStatTypeStruct.ToReport)
+ CurrentGraphData.GraphTitle = "";
+ else
+ CurrentGraphData.GraphTitle = string.Format(Catalog.GetString("Subtraction between {0} {1} and {0} {2}"), operation, test1, test2);
+
+
+ if(sessions.Count == 1) {
+ //four series, the four columns
+ serieIndex = new GraphSerie();
+ serieJump1 = new GraphSerie();
+ serieJump2 = new GraphSerie();
+
+ serieIndex.Title = Catalog.GetString("Result");
+ serieJump1.Title = test1;
+ serieJump2.Title = test2;
+
+ serieIndex.IsLeftAxis = true;
+ serieJump1.IsLeftAxis = false;
+ serieJump2.IsLeftAxis = false;
+
+ CurrentGraphData.LabelLeft =
+ test1 + " " + Catalog.GetString("TF") + "(s), " +
+ test2 + " " + Catalog.GetString("TF") + "(s)";
+ CurrentGraphData.LabelRight = Catalog.GetString("TF") + "(s)";
+ } else {
+ for(int i=0; i < sessions.Count ; i++) {
+ string [] stringFullResults = sessions[i].ToString().Split(new char[] {':'});
+ CurrentGraphData.XAxisNames.Add(stringFullResults[1].ToString());
+ }
+ CurrentGraphData.LabelLeft = Catalog.GetString("TF") + "(s)";
+ CurrentGraphData.LabelRight = "";
+ }
+ }
+
+ protected override void printData (string [] statValues)
+ {
+ //values are recorded for calculating later AVG and SD
+ recordStatValues(statValues);
+
+ if(sessions.Count == 1) {
+ int i = 0;
+ bool foundAVG = false;
+ //we need to save this transposed
+ foreach (string myValue in statValues)
+ {
+ if(i == 0) {
+ if( myValue == Catalog.GetString("AVG"))
+ foundAVG = true;
+ else
+ CurrentGraphData.XAxisNames.Add(myValue);
+ } else if(i == 1) {
+ if(foundAVG)
+ serieIndex.Avg = Convert.ToDouble(myValue);
+ else
+ serieIndex.SerieData.Add(myValue);
+ } else if(i == 2) {
+ if(foundAVG)
+ serieJump1.Avg = Convert.ToDouble(myValue);
+ else
+ serieJump1.SerieData.Add(myValue);
+ } else if(i == 3) {
+ if(foundAVG)
+ serieJump2.Avg = Convert.ToDouble(myValue);
+ else
+ serieJump2.SerieData.Add(myValue);
+ }
+
+ if(foundAVG && i == dataColumns) {
+ //add created series to GraphSeries ArrayList
+ //check don't do it two times
+ if(GraphSeries.Count == 0) {
+ GraphSeries.Add(serieJump1);
+ GraphSeries.Add(serieJump2);
+ GraphSeries.Add(serieIndex);
+ }
+ return;
+ }
+
+ i++;
+ }
+ } else {
+ GraphSerie mySerie = new GraphSerie();
+ mySerie.IsLeftAxis = true;
+
+ int i=0;
+ foreach (string myValue in statValues) {
+ if( myValue == Catalog.GetString("SD") )
+ return;
+
+ if(i == 0)
+ mySerie.Title = myValue;
+ else if( i == sessions.Count + 1 ) { //eg, for 2 sessions: [(0)person name, (1)sess1, (2)sess2, (3)AVG]
+ if(myValue != "-")
+ mySerie.Avg = Convert.ToDouble(myValue);
+ } else
+ mySerie.SerieData.Add(myValue);
+
+ i++;
+ }
+ GraphSeries.Add(mySerie);
+ }
+ }
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]