Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs	(revision 9376)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.cs	(revision 9377)
@@ -22,5 +22,4 @@
 using System;
 using System.Collections.Generic;
-using System.Drawing;
 using System.Linq;
 using System.Windows.Forms;
@@ -34,19 +33,18 @@
   [View("RunCollection Chart Analysis View")]
   [Content(typeof(RunCollection), false)]
-  public sealed partial class RunCollectionStatisticalTabularView : ItemView {
-    public RunCollectionStatisticalTabularView() {
+  public sealed partial class ChartAnalysisView : ItemView {
+    public new RunCollection Content {
+      get { return (RunCollection)base.Content; }
+      set { base.Content = value; }
+    }
+
+    public override bool ReadOnly {
+      get { return true; }
+      set { /*not needed because results are always readonly */}
+    }
+
+    public ChartAnalysisView() {
       InitializeComponent();
       stringConvertibleMatrixView.DataGridView.RowHeaderMouseDoubleClick += new DataGridViewCellMouseEventHandler(DataGridView_RowHeaderMouseDoubleClick);
-    }
-
-    void DataGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) {
-      if (e.RowIndex >= 0) {
-        IRun run = Content.ElementAt(e.RowIndex);
-        IContentView view = MainFormManager.MainForm.ShowContent(run);
-        if (view != null) {
-          view.ReadOnly = this.ReadOnly;
-          view.Locked = this.Locked;
-        }
-      }
     }
 
@@ -63,14 +61,5 @@
     }
 
-    public new RunCollection Content {
-      get { return (RunCollection)base.Content; }
-      set { base.Content = value; }
-    }
-
-    public override bool ReadOnly {
-      get { return true; }
-      set { /*not needed because results are always readonly */}
-    }
-
+    #region Content Events
     protected override void OnContentChanged() {
       base.OnContentChanged();
@@ -83,5 +72,4 @@
     }
 
-    #region events
     protected override void RegisterContentEvents() {
       base.RegisterContentEvents();
@@ -140,14 +128,70 @@
     #endregion
 
+    #region Events
+    void DataGridView_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e) {
+      if (e.RowIndex >= 0) {
+        IRun run = Content.ElementAt(stringConvertibleMatrixView.GetRowIndex(e.RowIndex));
+        IContentView view = MainFormManager.MainForm.ShowContent(run);
+        if (view != null) {
+          view.ReadOnly = this.ReadOnly;
+          view.Locked = this.Locked;
+        }
+      }
+    }
+
+    private void dataTableComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      UpdateDataRowComboBox();
+    }
+
+    private void dataRowComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      RebuildCombinedDataTable();
+    }
+
+    private void addLineToChart_Click(object sender, EventArgs e) {
+      string resultName = (string)dataTableComboBox.SelectedItem;
+      string rowName = (string)dataRowComboBox.SelectedItem;
+      var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
+
+      foreach (Run run in runs) {
+        DataTable resTable = (DataTable)run.Results[resultName];
+        DataRow row = resTable.Rows[rowName];
+        var values = row.Values.ToArray();
+        double k, d;
+        LinearLeastSquaresFitting.Calculate(values, out k, out d);
+
+        DataRow newRow = new DataRow(row.Name + " Fitted Line");
+        for (int i = 0; i < values.Count(); i++) {
+          newRow.Values.Add(k * i + d);
+        }
+
+        if (!resTable.Rows.ContainsKey(newRow.Name))
+          resTable.Rows.Add(newRow);
+      }
+    }
+
+    private void addValuesButton_Click(object sender, EventArgs e) {
+      string resultName = (string)dataTableComboBox.SelectedItem;
+      string rowName = (string)dataRowComboBox.SelectedItem;
+      var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
+      StringMatrix sm = (StringMatrix)stringConvertibleMatrixView.Content;
+
+      Content.UpdateOfRunsInProgress = true;
+      for (int i = 0; i < runs.Count(); i++) {
+        IRun run = runs.ElementAt(i);
+
+        for (int j = 0; j < sm.ColumnNames.Count(); j++) {
+          string newResultName = resultName + " " + rowName + " " + sm.ColumnNames.ElementAt(j);
+          if (!run.Results.ContainsKey(newResultName))
+            run.Results.Add(new KeyValuePair<string, Core.IItem>(newResultName, new DoubleValue(double.Parse(sm[i, j]))));
+        }
+      }
+      Content.UpdateOfRunsInProgress = false;
+      //update column names of run collection
+      Content.Modify();
+    }
+    #endregion
+
     private void UpdateRun(IRun run) {
       //TODO: hacky di hack... this is baaaadddd
-      RebuildCombinedDataTable();
-    }
-
-    private void dataTableComboBox_SelectedIndexChanged(object sender, EventArgs e) {
-      UpdateDataRowComboBox();
-    }
-
-    private void dataRowComboBox_SelectedIndexChanged(object sender, EventArgs e) {
       RebuildCombinedDataTable();
     }
@@ -181,5 +225,4 @@
       string resultName = (string)dataTableComboBox.SelectedItem;
       string rowName = (string)dataRowComboBox.SelectedItem;
-
       string[] columnNames = new string[] { "Count", "Minimum", "Maximum", "Average", "Median", "Standard Deviation", "Variance", "25th Percentile", "75th Percentile", "Gradient", "Relative Error", "Avg. of Upper 25 %", " Avg. of Lower 25 %", "Avg. of First 25 %", "Avg. of Last 25 %" };
 
@@ -193,4 +236,5 @@
       foreach (Run run in runs) {
         DataTable resTable = (DataTable)run.Results[resultName];
+        dt.SortableView = true;
         DataRow row = resTable.Rows[rowName];
         var values = row.Values.AsEnumerable();
@@ -234,74 +278,4 @@
       stringConvertibleMatrixView.Content = dt;
     }
-
-    private void addLineToChart_Click(object sender, EventArgs e) {
-      string resultName = (string)dataTableComboBox.SelectedItem;
-      string rowName = (string)dataRowComboBox.SelectedItem;
-      var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
-
-      foreach (Run run in runs) {
-        DataTable resTable = (DataTable)run.Results[resultName];
-        DataRow row = resTable.Rows[rowName];
-        var values = row.Values.ToArray();
-        double k, d;
-        LinearLeastSquaresFitting.Calculate(values, out k, out d);
-
-        DataRow newRow = new DataRow(row.Name + " Fitted Line");
-        for (int i = 0; i < values.Count(); i++) {
-          newRow.Values.Add(k * i + d);
-        }
-
-        if (!resTable.Rows.ContainsKey(newRow.Name))
-          resTable.Rows.Add(newRow);
-      }
-    }
-
-    private void addValuesButton_Click(object sender, EventArgs e) {
-      string resultName = (string)dataTableComboBox.SelectedItem;
-      string rowName = (string)dataRowComboBox.SelectedItem;
-      var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
-      StringMatrix sm = (StringMatrix)stringConvertibleMatrixView.Content;
-
-      Content.UpdateOfRunsInProgress = true;
-      for (int i = 0; i < runs.Count(); i++) {
-        IRun run = runs.ElementAt(i);
-
-        for (int j = 0; j < sm.ColumnNames.Count(); j++) {
-          string newResultName = resultName + " " + rowName + " " + sm.ColumnNames.ElementAt(j);
-          if (!run.Results.ContainsKey(newResultName))
-            run.Results.Add(new KeyValuePair<string, Core.IItem>(newResultName, new DoubleValue(double.Parse(sm[i, j]))));
-        }
-      }
-      Content.UpdateOfRunsInProgress = false;
-      //update column names of run collection
-      Content.Modify();
-    }
-
-    private void colorButton_Click(object sender, EventArgs e) {
-      string resultName = (string)dataTableComboBox.SelectedItem;
-      string rowName = (string)dataRowComboBox.SelectedItem;
-      var runs = Content.Where(x => x.Results.ContainsKey(resultName) && x.Visible);
-      Dictionary<int, double> values = new Dictionary<int, double>();
-
-      if (stringConvertibleMatrixView.DataGridView.CurrentCell != null) {
-        int curIndex = stringConvertibleMatrixView.DataGridView.CurrentCell.ColumnIndex;
-
-        for (int i = 0; i < stringConvertibleMatrixView.Content.Rows; i++) {
-          values[i] = double.Parse(stringConvertibleMatrixView.Content.GetValue(i, curIndex));
-        }
-
-        var orderedValues = values.OrderBy(x => x.Value);
-
-        for (int i = 0; i < orderedValues.Count(); i++) {
-          var row = stringConvertibleMatrixView.DataGridView.Rows[orderedValues.ElementAt(i).Key];
-
-          int r = (int)Math.Round((double)i / (double)orderedValues.Count() * 255.0);
-          int g = (int)Math.Round(((double)orderedValues.Count() - (double)i) / (double)orderedValues.Count() * 255.0);
-
-          Color color = Color.FromArgb(r, g, 0);
-          row.DefaultCellStyle.ForeColor = color;
-        }
-      }
-    }
   }
 }
Index: /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs
===================================================================
--- /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs	(revision 9376)
+++ /branches/StatisticalTesting/HeuristicLab.Analysis.Statistics/3.3/ChartAnalysisView.designer.cs	(revision 9377)
@@ -21,5 +21,5 @@
 
 namespace HeuristicLab.Analysis.Statistics {
-  partial class RunCollectionStatisticalTabularView {
+  partial class ChartAnalysisView {
     /// <summary>
     /// Required designer variable.
@@ -52,5 +52,5 @@
       this.stringConvertibleMatrixView.Location = new System.Drawing.Point(3, 59);
       this.stringConvertibleMatrixView.Name = "stringConvertibleMatrixView";
-      this.stringConvertibleMatrixView.ReadOnly = false;
+      this.stringConvertibleMatrixView.ReadOnly = true;
       this.stringConvertibleMatrixView.ShowRowsAndColumnsTextBox = true;
       this.stringConvertibleMatrixView.ShowStatisticalInformation = true;
@@ -122,5 +122,5 @@
       this.addValuesButton.Click += new System.EventHandler(this.addValuesButton_Click);
       // 
-      // RunCollectionStatisticalTabularView
+      // ChartAnalysisView
       // 
       this.Controls.Add(this.addValuesButton);
@@ -131,5 +131,5 @@
       this.Controls.Add(this.dataTableComboBox);
       this.Controls.Add(this.stringConvertibleMatrixView);
-      this.Name = "RunCollectionStatisticalTabularView";
+      this.Name = "ChartAnalysisView";
       this.Size = new System.Drawing.Size(498, 385);
       this.ResumeLayout(false);
