Index: /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs
===================================================================
--- /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs	(revision 14383)
+++ /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingChartView.cs	(revision 14384)
@@ -96,5 +96,5 @@
 
         // not checked -> remove
-        if (!VariableIsChecked(variableName)) {
+        if (!IsVariableChecked(variableName)) {
           dataTableView.SetRowEnabled(variableName, false);
           dataTable.SelectedRows.Remove(variableName);
@@ -305,5 +305,5 @@
       dataTable.SelectedRows.Clear();
       foreach (var selectedRow in selectedDataRows) {
-        if (VariableIsChecked(selectedRow.Name))
+        if (IsVariableChecked(selectedRow.Name))
           dataTable.SelectedRows.Add(selectedRow);
       }
Index: /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs
===================================================================
--- /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs	(revision 14383)
+++ /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/PreprocessingCheckedVariablesView.cs	(revision 14384)
@@ -21,4 +21,5 @@
 
 using System;
+using System.Collections.Generic;
 using System.Drawing;
 using System.Linq;
@@ -43,8 +44,10 @@
     }
 
-    protected bool VariableIsChecked(string name) {
+    protected bool IsVariableChecked(string name) {
       return Content.VariableItemList.CheckedItems.Any(x => x.Value.Value == name);
     }
-
+    protected IList<string> GetCheckedVariables() {
+      return checkedItemList.Content.CheckedItems.Select(i => i.Value.Value).ToList();
+    }
 
     protected override void OnContentChanged() {
Index: /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs
===================================================================
--- /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs	(revision 14383)
+++ /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.Designer.cs	(revision 14384)
@@ -46,6 +46,9 @@
     private void InitializeComponent() {
       this.frameTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+      this.columnHeaderScrollPanel = new System.Windows.Forms.Panel();
       this.columnHeaderTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+      this.rowHeaderScrollPanel = new System.Windows.Forms.Panel();
       this.rowHeaderTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
+      this.bodyScrollPanel = new System.Windows.Forms.Panel();
       this.bodyTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
       ((System.ComponentModel.ISupportInitialize)(this.splitContainer)).BeginInit();
@@ -54,4 +57,7 @@
       this.splitContainer.SuspendLayout();
       this.frameTableLayoutPanel.SuspendLayout();
+      this.columnHeaderScrollPanel.SuspendLayout();
+      this.rowHeaderScrollPanel.SuspendLayout();
+      this.bodyScrollPanel.SuspendLayout();
       this.SuspendLayout();
       // 
@@ -68,7 +74,7 @@
       this.frameTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
       this.frameTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
-      this.frameTableLayoutPanel.Controls.Add(this.columnHeaderTableLayoutPanel, 1, 0);
-      this.frameTableLayoutPanel.Controls.Add(this.rowHeaderTableLayoutPanel, 0, 1);
-      this.frameTableLayoutPanel.Controls.Add(this.bodyTableLayoutPanel, 1, 1);
+      this.frameTableLayoutPanel.Controls.Add(this.columnHeaderScrollPanel, 1, 0);
+      this.frameTableLayoutPanel.Controls.Add(this.rowHeaderScrollPanel, 0, 1);
+      this.frameTableLayoutPanel.Controls.Add(this.bodyScrollPanel, 1, 1);
       this.frameTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
       this.frameTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
@@ -80,46 +86,85 @@
       this.frameTableLayoutPanel.TabIndex = 0;
       // 
+      // columnHeaderScrollPanel
+      // 
+      this.columnHeaderScrollPanel.Controls.Add(this.columnHeaderTableLayoutPanel);
+      this.columnHeaderScrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.columnHeaderScrollPanel.Location = new System.Drawing.Point(40, 0);
+      this.columnHeaderScrollPanel.Margin = new System.Windows.Forms.Padding(0);
+      this.columnHeaderScrollPanel.Name = "columnHeaderScrollPanel";
+      this.columnHeaderScrollPanel.Size = new System.Drawing.Size(699, 40);
+      this.columnHeaderScrollPanel.TabIndex = 3;
+      // 
       // columnHeaderTableLayoutPanel
       // 
+      this.columnHeaderTableLayoutPanel.AutoSize = true;
+      this.columnHeaderTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
       this.columnHeaderTableLayoutPanel.ColumnCount = 2;
       this.columnHeaderTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.columnHeaderTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.columnHeaderTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.columnHeaderTableLayoutPanel.Location = new System.Drawing.Point(43, 3);
+      this.columnHeaderTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Left;
+      this.columnHeaderTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
+      this.columnHeaderTableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
       this.columnHeaderTableLayoutPanel.Name = "columnHeaderTableLayoutPanel";
       this.columnHeaderTableLayoutPanel.RowCount = 1;
       this.columnHeaderTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.columnHeaderTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.columnHeaderTableLayoutPanel.Size = new System.Drawing.Size(693, 34);
+      this.columnHeaderTableLayoutPanel.Size = new System.Drawing.Size(0, 40);
       this.columnHeaderTableLayoutPanel.TabIndex = 1;
       // 
+      // rowHeaderScrollPanel
+      // 
+      this.rowHeaderScrollPanel.Controls.Add(this.rowHeaderTableLayoutPanel);
+      this.rowHeaderScrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.rowHeaderScrollPanel.Location = new System.Drawing.Point(0, 40);
+      this.rowHeaderScrollPanel.Margin = new System.Windows.Forms.Padding(0);
+      this.rowHeaderScrollPanel.Name = "rowHeaderScrollPanel";
+      this.rowHeaderScrollPanel.Size = new System.Drawing.Size(40, 477);
+      this.rowHeaderScrollPanel.TabIndex = 4;
+      // 
       // rowHeaderTableLayoutPanel
       // 
+      this.rowHeaderTableLayoutPanel.AutoSize = true;
+      this.rowHeaderTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
       this.rowHeaderTableLayoutPanel.ColumnCount = 1;
       this.rowHeaderTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.rowHeaderTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.rowHeaderTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.rowHeaderTableLayoutPanel.Location = new System.Drawing.Point(3, 43);
+      this.rowHeaderTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Top;
+      this.rowHeaderTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
+      this.rowHeaderTableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
       this.rowHeaderTableLayoutPanel.Name = "rowHeaderTableLayoutPanel";
       this.rowHeaderTableLayoutPanel.RowCount = 2;
       this.rowHeaderTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.rowHeaderTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.rowHeaderTableLayoutPanel.Size = new System.Drawing.Size(34, 471);
+      this.rowHeaderTableLayoutPanel.Size = new System.Drawing.Size(40, 0);
       this.rowHeaderTableLayoutPanel.TabIndex = 2;
       // 
+      // bodyScrollPanel
+      // 
+      this.bodyScrollPanel.AutoScroll = true;
+      this.bodyScrollPanel.Controls.Add(this.bodyTableLayoutPanel);
+      this.bodyScrollPanel.Dock = System.Windows.Forms.DockStyle.Fill;
+      this.bodyScrollPanel.Location = new System.Drawing.Point(40, 40);
+      this.bodyScrollPanel.Margin = new System.Windows.Forms.Padding(0);
+      this.bodyScrollPanel.Name = "bodyScrollPanel";
+      this.bodyScrollPanel.Size = new System.Drawing.Size(699, 477);
+      this.bodyScrollPanel.TabIndex = 5;
+      this.bodyScrollPanel.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bodyScrollPanel_Scroll);
+      // 
       // bodyTableLayoutPanel
       // 
+      this.bodyTableLayoutPanel.AutoSize = true;
+      this.bodyTableLayoutPanel.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink;
       this.bodyTableLayoutPanel.ColumnCount = 2;
       this.bodyTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.bodyTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.bodyTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.bodyTableLayoutPanel.Location = new System.Drawing.Point(43, 43);
+      this.bodyTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
+      this.bodyTableLayoutPanel.Margin = new System.Windows.Forms.Padding(0);
       this.bodyTableLayoutPanel.Name = "bodyTableLayoutPanel";
       this.bodyTableLayoutPanel.RowCount = 2;
       this.bodyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
       this.bodyTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
-      this.bodyTableLayoutPanel.Size = new System.Drawing.Size(693, 471);
+      this.bodyTableLayoutPanel.Size = new System.Drawing.Size(0, 0);
       this.bodyTableLayoutPanel.TabIndex = 0;
-      this.bodyTableLayoutPanel.Scroll += new System.Windows.Forms.ScrollEventHandler(this.bodyTableLayoutPanel_Scroll);
       // 
       // ScatterPlotMultiView
@@ -134,4 +179,10 @@
       this.splitContainer.ResumeLayout(false);
       this.frameTableLayoutPanel.ResumeLayout(false);
+      this.columnHeaderScrollPanel.ResumeLayout(false);
+      this.columnHeaderScrollPanel.PerformLayout();
+      this.rowHeaderScrollPanel.ResumeLayout(false);
+      this.rowHeaderScrollPanel.PerformLayout();
+      this.bodyScrollPanel.ResumeLayout(false);
+      this.bodyScrollPanel.PerformLayout();
       this.ResumeLayout(false);
 
@@ -144,4 +195,7 @@
     private System.Windows.Forms.TableLayoutPanel rowHeaderTableLayoutPanel;
     private System.Windows.Forms.TableLayoutPanel bodyTableLayoutPanel;
+    private System.Windows.Forms.Panel columnHeaderScrollPanel;
+    private System.Windows.Forms.Panel rowHeaderScrollPanel;
+    private System.Windows.Forms.Panel bodyScrollPanel;
   }
 }
Index: /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs
===================================================================
--- /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs	(revision 14383)
+++ /trunk/sources/HeuristicLab.DataPreprocessing.Views/3.4/ScatterPlotMultiView.cs	(revision 14384)
@@ -7,4 +7,5 @@
 using HeuristicLab.Collections;
 using HeuristicLab.Common;
+using HeuristicLab.Core.Views;
 using HeuristicLab.Data;
 using HeuristicLab.MainForm;
@@ -15,30 +16,36 @@
   [Content(typeof(ScatterPlotContent), false)]
   public partial class ScatterPlotMultiView : PreprocessingCheckedVariablesView {
-    private const int MAX_AUTO_SIZE_ELEMENTS = 6;
-    private const int FIXED_CHART_WIDTH = 250;
-    private const int FIXED_CHART_HEIGHT = 150;
+    private const int MaxAutoSizeElements = 6;
+    private const int FixedChartWidth = 250;
+    private const int FixedChartHeight = 150;
+
+    private readonly IDictionary<string, Label> columnHeaderCache;
+    private readonly IDictionary<string, Label> rowHeaderCache;
+    private readonly IDictionary<Tuple<string/*col*/, string/*row*/>, ItemView> bodyCache;
 
     public ScatterPlotMultiView() {
       InitializeComponent();
 
-      columnHeaderTableLayoutPanel.HorizontalScroll.Enabled = true;
-      columnHeaderTableLayoutPanel.VerticalScroll.Enabled = false;
-      columnHeaderTableLayoutPanel.HorizontalScroll.Visible = false;
-      columnHeaderTableLayoutPanel.VerticalScroll.Visible = false;
-
-      rowHeaderTableLayoutPanel.HorizontalScroll.Enabled = false;
-      rowHeaderTableLayoutPanel.VerticalScroll.Enabled = true;
-      rowHeaderTableLayoutPanel.HorizontalScroll.Visible = false;
-      rowHeaderTableLayoutPanel.VerticalScroll.Visible = false;
-
-      bodyTableLayoutPanel.HorizontalScroll.Enabled = true;
-      bodyTableLayoutPanel.VerticalScroll.Enabled = true;
-      bodyTableLayoutPanel.HorizontalScroll.Visible = true;
-      bodyTableLayoutPanel.VerticalScroll.Visible = true;
-      bodyTableLayoutPanel.AutoScroll = true;
-
-      bodyTableLayoutPanel.MouseWheel += bodyTableLayoutPanel_MouseWheel;
-
-      splitContainer.Panel1Collapsed = true; // ToDo: remove after correctly handling unchecks
+      columnHeaderScrollPanel.HorizontalScroll.Enabled = true;
+      columnHeaderScrollPanel.VerticalScroll.Enabled = false;
+      columnHeaderScrollPanel.HorizontalScroll.Visible = false;
+      columnHeaderScrollPanel.VerticalScroll.Visible = false;
+
+      rowHeaderScrollPanel.HorizontalScroll.Enabled = false;
+      rowHeaderScrollPanel.VerticalScroll.Enabled = true;
+      rowHeaderScrollPanel.HorizontalScroll.Visible = false;
+      rowHeaderScrollPanel.VerticalScroll.Visible = false;
+
+      bodyScrollPanel.HorizontalScroll.Enabled = true;
+      bodyScrollPanel.VerticalScroll.Enabled = true;
+      bodyScrollPanel.HorizontalScroll.Visible = true;
+      bodyScrollPanel.VerticalScroll.Visible = true;
+      bodyScrollPanel.AutoScroll = true;
+
+      columnHeaderCache = new Dictionary<string, Label>();
+      rowHeaderCache = new Dictionary<string, Label>();
+      bodyCache = new Dictionary<Tuple<string, string>, ItemView>();
+
+      bodyScrollPanel.MouseWheel += bodyScrollPanel_MouseWheel;
     }
 
@@ -57,5 +64,64 @@
     protected override void CheckedItemsChanged(object sender, CollectionItemsChangedEventArgs<IndexedItem<StringValue>> checkedItems) {
       base.CheckedItemsChanged(sender, checkedItems);
-
+      foreach (var variable in checkedItems.Items.Select(i => i.Value.Value)) {
+        if (IsVariableChecked(variable))
+          AddChartToTable(variable);
+        else
+          RemoveChartFromTable(variable);
+      }
+    }
+
+    private void AddChartToTable(string variable) {
+
+    }
+    // remove from headers and body and shift remaining slots to fill the gap
+    private void RemoveChartFromTable(string variable) {
+      frameTableLayoutPanel.SuspendLayout();
+
+      // remove column header
+      var colH = columnHeaderTableLayoutPanel;
+      int colIdx = colH.GetColumn(colH.Controls[variable]);
+      RemoveColumnHelper(colH, colIdx);
+
+      // remove row header
+      var rowH = rowHeaderTableLayoutPanel;
+      int rowIdx = rowH.GetRow(rowH.Controls[variable]);
+      RemoveRowHelper(rowH, rowIdx);
+
+      // remove from body
+      var body = bodyTableLayoutPanel;
+      RemoveColumnHelper(body, colIdx);
+      RemoveRowHelper(body, rowIdx);
+
+      frameTableLayoutPanel.ResumeLayout(true);
+    }
+
+    private void RemoveColumnHelper(TableLayoutPanel tlp, int idx) {
+      for (int r = 0; r < tlp.RowCount; r++)
+        tlp.Controls.Remove(tlp.GetControlFromPosition(idx, r));
+      for (int c = idx + 1; c < tlp.ColumnCount; c++) {
+        for (int r = 0; r < tlp.RowCount; r++) {
+          var control = tlp.GetControlFromPosition(c, r);
+          if (control != null) {
+            tlp.SetColumn(control, c - 1);
+          }
+        }
+      }
+      tlp.ColumnStyles.RemoveAt(tlp.ColumnCount - 1);
+      tlp.ColumnCount--;
+    }
+    private void RemoveRowHelper(TableLayoutPanel tlp, int idx) {
+      for (int c = 0; c < tlp.ColumnCount; c++)
+        tlp.Controls.Remove(tlp.GetControlFromPosition(c, idx));
+      for (int r = idx + 1; r < tlp.RowCount; r++) {
+        for (int c = 0; c < tlp.ColumnCount; c++) {
+          var control = tlp.GetControlFromPosition(c, r);
+          if (control != null) {
+            tlp.SetRow(control, r - 1);
+          }
+        }
+      }
+      tlp.RowStyles.RemoveAt(tlp.RowCount - 1);
+      tlp.RowCount--;
     }
 
@@ -64,11 +130,21 @@
       base.AddVariable(name);
     }
+
     protected override void RemoveVariable(string name) {
       base.RemoveVariable(name);
 
+      // clear caches
+      columnHeaderCache.Remove(name);
+      rowHeaderCache.Remove(name);
+      var keys = bodyCache.Keys.Where(t => t.Item1 == name || t.Item2 == name).ToList();
+      foreach (var key in keys)
+        bodyCache.Remove(key);
+
+      if (IsVariableChecked(name)) {
+        RemoveChartFromTable(name);
+      }
     }
     protected override void UpdateVariable(string name) {
       base.UpdateVariable(name);
-
     }
     protected override void ResetAllVariables() {
@@ -77,26 +153,91 @@
     #endregion
 
+
+    #region Creating Header and Body 
+    private Label GetColumnHeader(string variable) {
+      if (!columnHeaderCache.ContainsKey(variable)) {
+        columnHeaderCache.Add(variable, new Label() {
+          Text = variable,
+          TextAlign = ContentAlignment.MiddleCenter,
+          Name = variable,
+          Height = columnHeaderTableLayoutPanel.Height,
+          Dock = DockStyle.Fill,
+          Margin = new Padding(3)
+        });
+      }
+      return columnHeaderCache[variable];
+    }
+    private Label GetRowHeader(string variable) {
+      if (!rowHeaderCache.ContainsKey(variable)) {
+        rowHeaderCache.Add(variable, new Label() {
+          Text = variable,
+          TextAlign = ContentAlignment.MiddleCenter,
+          Name = variable,
+          Width = rowHeaderTableLayoutPanel.Width,
+          Dock = DockStyle.Fill,
+          Margin = new Padding(3)
+        });
+      }
+      return rowHeaderCache[variable];
+    }
+    private ItemView GetBody(string colVariable, string rowVariable) {
+      var key = Tuple.Create(colVariable, rowVariable);
+      if (!bodyCache.ContainsKey(key)) {
+        if (rowVariable == colVariable) { // use historgram if x and y variable are equal
+          PreprocessingDataTable dataTable = new PreprocessingDataTable();
+          DataRow dataRow = Content.CreateDataRow(rowVariable, DataRowVisualProperties.DataRowChartType.Histogram);
+          dataTable.Rows.Add(dataRow);
+          PreprocessingDataTableView pcv = new PreprocessingDataTableView {
+            Name = key.ToString(),
+            Content = dataTable,
+            Dock = DockStyle.Fill,
+            ShowLegend = false,
+            XAxisFormat = "G3"
+          };
+          pcv.ChartDoubleClick += HistogramDoubleClick;
+          bodyCache.Add(key, pcv);
+        } else { //scatter plot
+          ScatterPlot scatterPlot = Content.CreateScatterPlot(colVariable, rowVariable);
+          PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView {
+            Name = key.ToString(),
+            Content = scatterPlot,
+            Dock = DockStyle.Fill,
+            ShowLegend = false,
+            XAxisFormat = "G3"
+          };
+          pspv.ChartDoubleClick += ScatterPlotDoubleClick;
+          bodyCache.Add(key, pspv);
+        }
+      }
+      return bodyCache[key];
+    }
+    #endregion
+
+
+
+
     #region Generate Charts
     private void GenerateCharts() {
-      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
-      var contentTableLayoutPanels = new[] { columnHeaderTableLayoutPanel, rowHeaderTableLayoutPanel, bodyTableLayoutPanel };
-
-      // Clear table layouts
-      foreach (var tlp in contentTableLayoutPanels) {
-        tlp.Controls.Clear();
-        //Clear out the existing row and column styles
-        tlp.ColumnStyles.Clear();
-        tlp.RowStyles.Clear();
-      }
+      var variables = GetCheckedVariables();
+
+      // Clear old layouts and cache
+      foreach (var tableLayoutPanel in new[] { columnHeaderTableLayoutPanel, rowHeaderTableLayoutPanel, bodyTableLayoutPanel }) {
+        tableLayoutPanel.Controls.Clear();
+        tableLayoutPanel.ColumnStyles.Clear();
+        tableLayoutPanel.RowStyles.Clear();
+      }
+      columnHeaderCache.Clear();
+      rowHeaderCache.Clear();
+      bodyCache.Clear();
 
       // Set row and column count
-      columnHeaderTableLayoutPanel.ColumnCount = variables.Count + 1;
-      rowHeaderTableLayoutPanel.RowCount = variables.Count + 1;
+      columnHeaderTableLayoutPanel.ColumnCount = variables.Count;
+      rowHeaderTableLayoutPanel.RowCount = variables.Count;
       bodyTableLayoutPanel.ColumnCount = variables.Count;
       bodyTableLayoutPanel.RowCount = variables.Count;
 
       // Set column and row layout
-      int width = variables.Count <= MAX_AUTO_SIZE_ELEMENTS ? bodyTableLayoutPanel.Width / variables.Count : FIXED_CHART_WIDTH;
-      int height = variables.Count <= MAX_AUTO_SIZE_ELEMENTS ? bodyTableLayoutPanel.Height / variables.Count : FIXED_CHART_HEIGHT;
+      int width = variables.Count <= MaxAutoSizeElements ? bodyTableLayoutPanel.Width / variables.Count : FixedChartWidth;
+      int height = variables.Count <= MaxAutoSizeElements ? bodyTableLayoutPanel.Height / variables.Count : FixedChartHeight;
       for (int i = 0; i < variables.Count; i++) {
         columnHeaderTableLayoutPanel.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, width));
@@ -106,77 +247,30 @@
       }
 
-      //frameTableLayoutPanel.SuspendLayout();
+      frameTableLayoutPanel.SuspendLayout();
       AddHeaderToTableLayoutPanels();
       AddChartsToTableLayoutPanel();
-      //frameTableLayoutPanel.ResumeLayout(true);
+      UpdateHeaderMargin();
+      frameTableLayoutPanel.ResumeLayout(true);
     }
 
     private void AddHeaderToTableLayoutPanels() {
-      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
-      int width = variables.Count <= MAX_AUTO_SIZE_ELEMENTS ? bodyTableLayoutPanel.Width / variables.Count : FIXED_CHART_WIDTH;
-      int height = variables.Count <= MAX_AUTO_SIZE_ELEMENTS ? bodyTableLayoutPanel.Height / variables.Count : FIXED_CHART_HEIGHT;
-      for (int i = 0; i < variables.Count; i++) {
-        columnHeaderTableLayoutPanel.Controls.Add(new Label() {
-          Text = variables[i],
-          TextAlign = ContentAlignment.MiddleCenter,
-          Width = width,
-          Height = columnHeaderTableLayoutPanel.Height,
-          Dock = DockStyle.Fill,
-          Margin = new Padding(3)
-        }, i, 0);
-        rowHeaderTableLayoutPanel.Controls.Add(new Label() {
-          Text = variables[i],
-          TextAlign = ContentAlignment.MiddleCenter,
-          Width = rowHeaderTableLayoutPanel.Width,
-          Height = height,
-          Dock = DockStyle.Fill,
-          Margin = new Padding(3)
-        }, 0, i);
-      }
-
-      // Add empty labels with fixed size to correct scollbar width/height in headers
-      columnHeaderTableLayoutPanel.Controls.Add(new Panel() {
-        Width = bodyTableLayoutPanel.VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0,
-        Height = columnHeaderTableLayoutPanel.Height,
-        Dock = DockStyle.Fill,
-        //BackColor = Color.DarkRed
-      }, variables.Count, 0);
-      rowHeaderTableLayoutPanel.Controls.Add(new Panel() {
-        Width = rowHeaderTableLayoutPanel.Width,
-        Height = bodyTableLayoutPanel.HorizontalScroll.Visible ? SystemInformation.HorizontalScrollBarHeight : 0,
-        Dock = DockStyle.Fill,
-        //BackColor = Color.DarkRed
-      }, 0, variables.Count);
+      int i = 0;
+      foreach (var variable in GetCheckedVariables()) {
+        columnHeaderTableLayoutPanel.Controls.Add(GetColumnHeader(variable), i, 0);
+        rowHeaderTableLayoutPanel.Controls.Add(GetRowHeader(variable), 0, i);
+        i++;
+      }
     }
     private void AddChartsToTableLayoutPanel() {
-      List<string> variables = Content.PreprocessingData.GetDoubleVariableNames().ToList();
-
-      //set scatter plots and histograms
-      for (int x = 0; x < variables.Count; x++) {
-        for (int y = 0; y < variables.Count; y++) {
-          if (x == y) { // use historgram if x and y variable are equal
-            PreprocessingDataTable dataTable = new PreprocessingDataTable();
-            DataRow dataRow = Content.CreateDataRow(variables[x], DataRowVisualProperties.DataRowChartType.Histogram);
-            dataTable.Rows.Add(dataRow);
-            PreprocessingDataTableView pcv = new PreprocessingDataTableView {
-              Content = dataTable,
-              Dock = DockStyle.Fill,
-              ShowLegend = false,
-              XAxisFormat = "G3"
-            };
-            pcv.ChartDoubleClick += HistogramDoubleClick;
-            bodyTableLayoutPanel.Controls.Add(pcv, y, x);
-          } else { //scatter plot
-            ScatterPlot scatterPlot = Content.CreateScatterPlot(variables[x], variables[y]);
-            PreprocessingScatterPlotView pspv = new PreprocessingScatterPlotView {
-              Content = scatterPlot,
-              Dock = DockStyle.Fill,
-              ShowLegend = false,
-              XAxisFormat = "G3"
-            };
-            pspv.ChartDoubleClick += ScatterPlotDoubleClick;
-            bodyTableLayoutPanel.Controls.Add(pspv, x, y);
-          }
-        }
+      int c = 0;
+      foreach (var colVar in GetCheckedVariables()) {
+        if (!IsVariableChecked(colVar)) continue;
+        int r = 0;
+        foreach (var rowVar in GetCheckedVariables()) {
+          if (!IsVariableChecked(rowVar)) continue;
+          bodyTableLayoutPanel.Controls.Add(GetBody(colVar, rowVar), c, r);
+          r++;
+        }
+        c++;
       }
     }
@@ -221,30 +315,26 @@
     #endregion
 
-    private void bodyTableLayoutPanel_Scroll(object sender, ScrollEventArgs e) {
+    private void bodyScrollPanel_Scroll(object sender, ScrollEventArgs e) {
       SyncScroll();
 
-      // update "padding labels" after scrollbars are added or removed
-      var columHeaderPadding = columnHeaderTableLayoutPanel.Controls[columnHeaderTableLayoutPanel.Controls.Count - 1];
-      var rowHeaderPadding = rowHeaderTableLayoutPanel.Controls[rowHeaderTableLayoutPanel.ColumnCount - 1];
-      columHeaderPadding.Width = bodyTableLayoutPanel.VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0;
-      rowHeaderPadding.Height = bodyTableLayoutPanel.HorizontalScroll.Visible ? SystemInformation.HorizontalScrollBarHeight : 0;
-    }
-    private void bodyTableLayoutPanel_MouseWheel(object sender, MouseEventArgs e) {
+      UpdateHeaderMargin();
+    }
+    private void bodyScrollPanel_MouseWheel(object sender, MouseEventArgs e) {
       // Scrolling with the mouse wheel is not captured in the Scoll event
       SyncScroll();
     }
     private void SyncScroll() {
-      //Debug.WriteLine("H: {0} <- {1}", columnHeaderTableLayoutPanel.HorizontalScroll.Value, bodyTableLayoutPanel.HorizontalScroll.Value);
-      //Debug.WriteLine("V: {0} <- {1}", rowHeaderTableLayoutPanel.VerticalScroll.Value, bodyTableLayoutPanel.VerticalScroll.Value);
+      //Debug.WriteLine("H: {0} <- {1}", columnHeaderScrollPanel.HorizontalScroll.Value, bodyScrollPanel.HorizontalScroll.Value);
+      //Debug.WriteLine("V: {0} <- {1}", rowScrollLayoutPanel.VerticalScroll.Value, bodyScrollPanel.VerticalScroll.Value);
 
       frameTableLayoutPanel.SuspendRepaint();
 
-      columnHeaderTableLayoutPanel.HorizontalScroll.Minimum = bodyTableLayoutPanel.HorizontalScroll.Minimum;
-      columnHeaderTableLayoutPanel.HorizontalScroll.Maximum = bodyTableLayoutPanel.HorizontalScroll.Maximum;
-      rowHeaderTableLayoutPanel.VerticalScroll.Minimum = bodyTableLayoutPanel.VerticalScroll.Minimum;
-      rowHeaderTableLayoutPanel.VerticalScroll.Maximum = bodyTableLayoutPanel.VerticalScroll.Maximum;
-
-      columnHeaderTableLayoutPanel.HorizontalScroll.Value = Math.Max(bodyTableLayoutPanel.HorizontalScroll.Value, 1);
-      rowHeaderTableLayoutPanel.VerticalScroll.Value = Math.Max(bodyTableLayoutPanel.VerticalScroll.Value, 1);
+      columnHeaderScrollPanel.HorizontalScroll.Minimum = bodyScrollPanel.HorizontalScroll.Minimum;
+      columnHeaderScrollPanel.HorizontalScroll.Maximum = bodyScrollPanel.HorizontalScroll.Maximum;
+      rowHeaderScrollPanel.VerticalScroll.Minimum = bodyScrollPanel.VerticalScroll.Minimum;
+      rowHeaderScrollPanel.VerticalScroll.Maximum = bodyScrollPanel.VerticalScroll.Maximum;
+
+      columnHeaderScrollPanel.HorizontalScroll.Value = Math.Max(bodyScrollPanel.HorizontalScroll.Value, 1);
+      rowHeaderScrollPanel.VerticalScroll.Value = Math.Max(bodyScrollPanel.VerticalScroll.Value, 1);
       // minimum 1 is nececary  because of two factors:
       // - setting the Value-property of Horizontal/VerticalScroll updates the internal state but the Value-property stays 0
@@ -254,4 +344,10 @@
       frameTableLayoutPanel.ResumeRepaint(true);
     }
+
+    // add a margin to the header table layouts if the scollbar is visible to account for the width/height of the scrollbar
+    private void UpdateHeaderMargin() {
+      columnHeaderScrollPanel.Margin = new Padding(0, 0, bodyScrollPanel.VerticalScroll.Visible ? SystemInformation.VerticalScrollBarWidth : 0, 0);
+      rowHeaderScrollPanel.Margin = new Padding(0, 0, 0, bodyScrollPanel.HorizontalScroll.Visible ? SystemInformation.HorizontalScrollBarHeight : 0);
+    }
   }
 }
