Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.Designer.cs	(revision 8103)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.Designer.cs	(revision 8104)
@@ -41,5 +41,5 @@
       this.chart.Location = new System.Drawing.Point(0, 0);
       this.chart.Name = "chart";
-      this.chart.Size = new System.Drawing.Size(358, 225);
+      this.chart.Size = new System.Drawing.Size(289, 220);
       this.chart.TabIndex = 0;
       this.chart.CustomizeLegend += new System.EventHandler<System.Windows.Forms.DataVisualization.Charting.CustomizeLegendEventArgs>(this.chart_CustomizeLegend);
@@ -50,5 +50,4 @@
       // 
       this.AllowDrop = true;
-      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Inherit;
       this.Controls.Add(this.chart);
Index: /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs
===================================================================
--- /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs	(revision 8103)
+++ /trunk/sources/HeuristicLab.Problems.DataAnalysis.Views/3.4/Regression/RegressionSolutionResidualHistogram.cs	(revision 8104)
@@ -38,8 +38,4 @@
     protected const string TRAINING_SAMPLES = "Training samples";
     protected const string TEST_SAMPLES = "Test samples";
-    /// <summary>
-    /// used to reduce code duplication
-    /// </summary>
-    protected readonly string[] ALL_SERIES = new string[] { ALL_SAMPLES, TRAINING_SAMPLES, TEST_SAMPLES };
     /// <summary>
     /// approximate amount of bins 
@@ -62,5 +58,5 @@
       InitializeComponent();
       relativeFrequencies = new Dictionary<string, List<List<double>>>();
-      foreach (string series in ALL_SERIES) {
+      foreach (string series in new List<String>() { ALL_SAMPLES, TRAINING_SAMPLES, TEST_SAMPLES }) {
         chart.Series.Add(series);
         chart.Series[series].LegendText = series;
@@ -87,11 +83,11 @@
 
     private void RedrawChart() {
-      foreach (string series in ALL_SERIES) {
-        chart.Series[series].Points.Clear();
-        relativeFrequencies[series].Clear();
+      foreach (Series series in chart.Series) {
+        series.Points.Clear();
+        relativeFrequencies[series.Name].Clear();
       }
       if (Content != null) {
-        Dictionary<string, List<double>> residuals = CalculateResiduals();
-        double realMax = Math.Max(Math.Abs(residuals[ALL_SAMPLES].Min()), Math.Abs(residuals[ALL_SAMPLES].Max()));
+        List<double> residuals = CalculateResiduals();
+        double realMax = Math.Max(Math.Abs(residuals.Min()), Math.Abs(residuals.Max()));
         double roundedMax = HumanRoundMax(realMax);
         double intervalWidth = (roundedMax * 2.0) / bins;
@@ -102,8 +98,8 @@
         roundedMax = help * intervalWidth;
 
-        foreach (string series in ALL_SERIES) {
-          CalculateFrequencies(residuals[series], series, roundedMax, intervalWidth);
+        foreach (Series series in chart.Series) {
+          CalculateFrequencies(residuals, series.Name, roundedMax, intervalWidth);
           if (!series.Equals(ALL_SAMPLES))
-            ShowValues(chart.Series[series], relativeFrequencies[series]);
+            ShowValues(series);
         }
 
@@ -132,10 +128,7 @@
     }
 
-    private Dictionary<string, List<double>> CalculateResiduals() {
-      Dictionary<string, List<double>> residuals = new Dictionary<string, List<double>>();
-
-      foreach (string series in ALL_SERIES) {
-        residuals[series] = new List<double>();
-      }
+    private List<double> CalculateResiduals() {
+      List<double> residuals = new List<double>();
+
       IRegressionProblemData problemdata = Content.ProblemData;
       List<double> targetValues = problemdata.Dataset.GetDoubleValues(Content.ProblemData.TargetVariable).ToList();
@@ -144,9 +137,5 @@
       for (int i = 0; i < Content.ProblemData.Dataset.Rows; i++) {
         double residual = estimatedValues[i] - targetValues[i];
-        residuals[ALL_SAMPLES].Add(residual);
-        if (i >= problemdata.TrainingPartition.Start && i < problemdata.TrainingPartition.End)
-          residuals[TRAINING_SAMPLES].Add(residual);
-        if (i >= problemdata.TestPartition.Start && i < problemdata.TestPartition.End)
-          residuals[TEST_SAMPLES].Add(residual);
+        residuals.Add(residual);
       }
       return residuals;
@@ -154,12 +143,43 @@
 
     private void CalculateFrequencies(List<double> residualValues, string series, double max, double intervalWidth) {
+      IEnumerable<double> relevantResiduals = residualValues;
+      IRegressionProblemData problemdata = Content.ProblemData;
+      if (series.Equals(TRAINING_SAMPLES)) {
+        relevantResiduals = residualValues.Skip(problemdata.TrainingPartition.Start).Take(problemdata.TrainingPartition.Size);
+      } else if (series.Equals(TEST_SAMPLES)) {
+        relevantResiduals = residualValues.Skip(problemdata.TestPartition.Start).Take(problemdata.TestPartition.Size);
+      }
+
       double intervalCenter = intervalWidth / 2.0;
-      double sampleCount = residualValues.Count;
+      double sampleCount = relevantResiduals.Count();
       double current = -max;
 
       for (int i = 0; i <= bins; i++) {
-        IEnumerable<double> help = residualValues.Where(x => x >= (current - intervalCenter) && x < (current + intervalCenter));
+        IEnumerable<double> help = relevantResiduals.Where(x => x >= (current - intervalCenter) && x < (current + intervalCenter));
         relativeFrequencies[series].Add(new List<double>() { current, help.Count() / sampleCount, current - intervalCenter, current + intervalCenter });
         current += intervalWidth;
+      }
+    }
+
+    private void ShowValues(Series series) {
+      List<List<double>> relativeSeriesFrequencies = relativeFrequencies[series.Name];
+      DataPointCollection seriesPoints = series.Points;
+
+      foreach (var valueList in relativeSeriesFrequencies) {
+        seriesPoints.AddXY(valueList[0], valueList[1]);
+        seriesPoints[seriesPoints.Count - 1]["from"] = valueList[2].ToString();
+        seriesPoints[seriesPoints.Count - 1]["to"] = valueList[3].ToString();
+      }
+    }
+
+    private void ToggleSeriesData(Series series) {
+      if (series.Points.Count > 0) {  //checks if series is shown
+        if (chart.Series.Any(s => s != series && s.Points.Count > 0)) {
+          series.Points.Clear();
+        }
+      } else if (Content != null) {
+        ShowValues(series);
+        chart.Legends[series.Legend].ForeColor = Color.Black;
+        chart.Refresh();
       }
     }
@@ -216,25 +236,4 @@
     }
     #endregion
-
-    private void ToggleSeriesData(Series series) {
-      if (series.Points.Count > 0) {  //checks if series is shown
-        if (chart.Series.Any(s => s != series && s.Points.Count > 0)) {
-          series.Points.Clear();
-        }
-      } else if (Content != null) {
-        ShowValues(series, relativeFrequencies[series.Name]);
-        chart.Legends[series.Legend].ForeColor = Color.Black;
-        chart.Refresh();
-      }
-    }
-    private void ShowValues(Series series, List<List<double>> relativeSeriesFrequencies) {
-      DataPointCollection seriesPoints = series.Points;
-
-      foreach (var valueList in relativeSeriesFrequencies) {
-        seriesPoints.AddXY(valueList[0], valueList[1]);
-        seriesPoints[seriesPoints.Count - 1]["from"] = valueList[2].ToString();
-        seriesPoints[seriesPoints.Count - 1]["to"] = valueList[3].ToString();
-      }
-    }
   }
 }
