Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs	(revision 15638)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.Designer.cs	(revision 15667)
@@ -51,4 +51,7 @@
       this.factorVarReplacementLabel = new System.Windows.Forms.Label();
       this.factorVarReplComboBox = new System.Windows.Forms.ComboBox();
+      this.ascendingCheckBox = new System.Windows.Forms.CheckBox();
+      this.sortByLabel = new System.Windows.Forms.Label();
+      this.sortByComboBox = new System.Windows.Forms.ComboBox();
       this.SuspendLayout();
       // 
@@ -63,9 +66,10 @@
       this.variableImactsArrayView.Name = "variableImactsArrayView";
       this.variableImactsArrayView.ReadOnly = true;
-      this.variableImactsArrayView.Size = new System.Drawing.Size(363, 278);
+      this.variableImactsArrayView.Size = new System.Drawing.Size(662, 278);
       this.variableImactsArrayView.TabIndex = 2;
       // 
       // dataPartitionComboBox
       // 
+      this.dataPartitionComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.dataPartitionComboBox.FormattingEnabled = true;
       this.dataPartitionComboBox.Items.AddRange(new object[] {
@@ -99,4 +103,5 @@
       // replacementComboBox
       // 
+      this.replacementComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.replacementComboBox.FormattingEnabled = true;
       this.replacementComboBox.Items.AddRange(new object[] {
@@ -122,4 +127,5 @@
       // factorVarReplComboBox
       // 
+      this.factorVarReplComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
       this.factorVarReplComboBox.FormattingEnabled = true;
       this.factorVarReplComboBox.Items.AddRange(new object[] {
@@ -133,8 +139,41 @@
       this.factorVarReplComboBox.SelectedIndexChanged += new System.EventHandler(this.replacementComboBox_SelectedIndexChanged);
       // 
+      // ascendingCheckBox
+      // 
+      this.ascendingCheckBox.AutoSize = true;
+      this.ascendingCheckBox.Location = new System.Drawing.Point(534, 6);
+      this.ascendingCheckBox.Name = "ascendingCheckBox";
+      this.ascendingCheckBox.Size = new System.Drawing.Size(76, 17);
+      this.ascendingCheckBox.TabIndex = 10;
+      this.ascendingCheckBox.Text = "Ascending";
+      this.ascendingCheckBox.UseVisualStyleBackColor = true;
+      this.ascendingCheckBox.CheckedChanged += new System.EventHandler(this.ascendingCheckBox_CheckedChanged);
+      // 
+      // sortByLabel
+      // 
+      this.sortByLabel.AutoSize = true;
+      this.sortByLabel.Location = new System.Drawing.Point(324, 6);
+      this.sortByLabel.Name = "sortByLabel";
+      this.sortByLabel.Size = new System.Drawing.Size(77, 13);
+      this.sortByLabel.TabIndex = 8;
+      this.sortByLabel.Text = "Sorting criteria:";
+      // 
+      // sortByComboBox
+      // 
+      this.sortByComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
+      this.sortByComboBox.FormattingEnabled = true;
+      this.sortByComboBox.Location = new System.Drawing.Point(407, 3);
+      this.sortByComboBox.Name = "sortByComboBox";
+      this.sortByComboBox.Size = new System.Drawing.Size(121, 21);
+      this.sortByComboBox.TabIndex = 9;
+      this.sortByComboBox.SelectedIndexChanged += new System.EventHandler(this.sortByComboBox_SelectedIndexChanged);
+      // 
       // ClassificationSolutionVariableImpactsView
       // 
       this.AllowDrop = true;
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
+      this.Controls.Add(this.ascendingCheckBox);
+      this.Controls.Add(this.sortByLabel);
+      this.Controls.Add(this.sortByComboBox);
       this.Controls.Add(this.factorVarReplComboBox);
       this.Controls.Add(this.factorVarReplacementLabel);
@@ -145,5 +184,5 @@
       this.Controls.Add(this.variableImactsArrayView);
       this.Name = "ClassificationSolutionVariableImpactsView";
-      this.Size = new System.Drawing.Size(369, 365);
+      this.Size = new System.Drawing.Size(668, 365);
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -160,4 +199,7 @@
     private System.Windows.Forms.Label factorVarReplacementLabel;
     private System.Windows.Forms.ComboBox factorVarReplComboBox;
+    private System.Windows.Forms.CheckBox ascendingCheckBox;
+    private System.Windows.Forms.Label sortByLabel;
+    private System.Windows.Forms.ComboBox sortByComboBox;
   }
 }
Index: trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs
===================================================================
--- trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 15638)
+++ trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Classification/ClassificationSolutionVariableImpactsView.cs	(revision 15667)
@@ -19,7 +19,10 @@
  */
 #endregion
+
 using System;
+using System.Collections.Generic;
 using System.Linq;
 using System.Threading.Tasks;
+using HeuristicLab.Common;
 using HeuristicLab.Data;
 using HeuristicLab.MainForm;
@@ -29,4 +32,5 @@
   [Content(typeof(IClassificationSolution))]
   public partial class ClassificationSolutionVariableImpactsView : DataAnalysisSolutionEvaluationView {
+    private Dictionary<string, double> rawVariableImpacts = new Dictionary<string, double>();
 
     public new IClassificationSolution Content {
@@ -40,4 +44,9 @@
       : base() {
       InitializeComponent();
+
+      //Little workaround. If you fill the ComboBox-Items in the other partial class, the UI-Designer will moan.
+      this.sortByComboBox.Items.AddRange(Enum.GetValues(typeof(ClassificationSolutionVariableImpactsCalculator.SortingCriteria)).Cast<object>().ToArray());
+      this.sortByComboBox.SelectedItem = ClassificationSolutionVariableImpactsCalculator.SortingCriteria.ImpactValue;
+
       this.dataPartitionComboBox.SelectedIndex = 0;
       this.replacementComboBox.SelectedIndex = 0;
@@ -75,4 +84,40 @@
     }
 
+
+    private void dataPartitionComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      UpdateVariableImpacts();
+    }
+
+    private void replacementComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      UpdateVariableImpacts();
+    }
+
+    private void sortByComboBox_SelectedIndexChanged(object sender, EventArgs e) {
+      //Update the default ordering (asc,desc), but remove the eventHandler beforehand (otherwise the data would be ordered twice)
+      ascendingCheckBox.CheckedChanged -= ascendingCheckBox_CheckedChanged;
+      switch ((ClassificationSolutionVariableImpactsCalculator.SortingCriteria)sortByComboBox.SelectedItem) {
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.ImpactValue:
+          ascendingCheckBox.Checked = false;
+          break;
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.Occurrence:
+          ascendingCheckBox.Checked = true;
+          break;
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.VariableName:
+          ascendingCheckBox.Checked = true;
+          break;
+        default:
+          throw new Exception("Cannot interpret SortingCriteria");
+      }
+      ascendingCheckBox.CheckedChanged += ascendingCheckBox_CheckedChanged;
+
+      UpdateDataOrdering();
+    }
+
+    private void ascendingCheckBox_CheckedChanged(object sender, EventArgs e) {
+      UpdateDataOrdering();
+    }
+    #endregion
+
+    #region Helper Methods
     private void UpdateVariableImpacts() {
       if (Content == null || replacementComboBox.SelectedIndex < 0
@@ -94,23 +139,53 @@
           mainForm.AddOperationProgressToView(this, "Calculating variable impacts for " + Content.Name);
 
+          //Remember the original ordering of the variables
           var impacts = ClassificationSolutionVariableImpactsCalculator.CalculateImpacts(Content, dataPartition, replMethod, factorReplMethod);
-          var impactArray = new DoubleArray(impacts.Select(i => i.Item2).ToArray());
-          impactArray.ElementNames = impacts.Select(i => i.Item1);
-          variableImactsArrayView.Content = (DoubleArray)impactArray.AsReadOnly();
+          var problemData = Content.ProblemData;
+          var inputvariables = new HashSet<string>(problemData.AllowedInputVariables.Union(Content.Model.VariablesUsedForPrediction));
+          var originalVariableOrdering = problemData.Dataset.VariableNames.Where(v => inputvariables.Contains(v)).Where(problemData.Dataset.VariableHasType<double>).ToList();
+          rawVariableImpacts.Clear();
+          originalVariableOrdering.ForEach(v => rawVariableImpacts.Add(v, impacts.First(vv => vv.Item1 == v).Item2));
         } finally {
           mainForm.RemoveOperationProgressFromView(this);
+          UpdateDataOrdering();
         }
       });
     }
 
-    #endregion
+    /// <summary>
+    /// Updates the <see cref="variableImactsArrayView"/> according to the selected ordering <see cref="ascendingCheckBox"/> of the selected Column <see cref="sortByComboBox"/>
+    /// The default is "Descending" by "VariableImpact" (as in previous versions)
+    /// </summary>
+    private void UpdateDataOrdering() {
+      //Check if valid sortingCriteria is selected and data exists
+      if (sortByComboBox.SelectedIndex == -1 || rawVariableImpacts == null || !rawVariableImpacts.Any()) { return; }
 
-    private void dataPartitionComboBox_SelectedIndexChanged(object sender, EventArgs e) {
-      UpdateVariableImpacts();
+      var selectedItem = (ClassificationSolutionVariableImpactsCalculator.SortingCriteria)sortByComboBox.SelectedItem;
+      bool ascending = ascendingCheckBox.Checked;
+
+      IEnumerable<KeyValuePair<string, double>> orderedEntries = null;
+
+      //Sort accordingly
+      switch (selectedItem) {
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.ImpactValue:
+          orderedEntries = ascending ? rawVariableImpacts.OrderBy(v => v.Value) : rawVariableImpacts.OrderByDescending(v => v.Value);
+          break;
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.Occurrence:
+          orderedEntries = ascending ? rawVariableImpacts : rawVariableImpacts.Reverse();
+          break;
+        case ClassificationSolutionVariableImpactsCalculator.SortingCriteria.VariableName:
+          orderedEntries = ascending ? rawVariableImpacts.OrderBy(v => v.Key, new NaturalStringComparer()) : rawVariableImpacts.OrderByDescending(v => v.Key, new NaturalStringComparer());
+          break;
+        default:
+          throw new Exception("Cannot interpret SortingCriteria");
+      }
+
+      //Write the data back
+      var impactArray = new DoubleArray(orderedEntries.Select(i => i.Value).ToArray()) {
+        ElementNames = orderedEntries.Select(i => i.Key)
+      };
+      variableImactsArrayView.Content = (DoubleArray)impactArray.AsReadOnly();
     }
-
-    private void replacementComboBox_SelectedIndexChanged(object sender, EventArgs e) {
-      UpdateVariableImpacts();
-    }
+    #endregion   
   }
 }
