Index: trunk/sources/HeuristicLab.DataAnalysis/Dataset.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAnalysis/Dataset.cs	(revision 207)
+++ trunk/sources/HeuristicLab.DataAnalysis/Dataset.cs	(revision 232)
@@ -60,4 +60,5 @@
       if(v != samples[columns * i + j]) {
         samples[columns * i + j] = v;
+        CreateDictionaries();
         FireChanged();
       }
@@ -85,8 +86,4 @@
       Rows = 1;
       Samples = new double[1];
-    }
-
-    void samples_Changed(object sender, EventArgs e) {
-      CreateDictionaries();
     }
 
@@ -233,4 +230,22 @@
       }
     }
+
+    public double GetMaximum(int column) {
+      double max = Double.NegativeInfinity;
+      for(int i = 0; i < Rows; i++) {
+        double val = GetValue(i, column);
+        if(val > max) max = val;
+      }
+      return max;
+    }
+
+    public double GetMinimum(int column) {
+      double min = Double.PositiveInfinity;
+      for(int i = 0; i < Rows; i++) {
+        double val = GetValue(i, column);
+        if(val < min) min = val;
+      }
+      return min;
+    }
   }
 }
Index: trunk/sources/HeuristicLab.DataAnalysis/DatasetView.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAnalysis/DatasetView.cs	(revision 207)
+++ trunk/sources/HeuristicLab.DataAnalysis/DatasetView.cs	(revision 232)
@@ -25,8 +25,5 @@
 
 namespace HeuristicLab.DataAnalysis {
-  public partial class DatasetView : ViewBase {
-
-    private OpenFileDialog openFileDialog;
-
+  public partial class DatasetView : EditorBase {
     public Dataset Dataset {
       get { return (Dataset)Item; }
@@ -37,8 +34,9 @@
     }
 
+    private double[] scalingFactor;
+    private double[] scalingOffset;
     public DatasetView()
       : base() {
       InitializeComponent();
-      openFileDialog = new OpenFileDialog();
     }
 
@@ -50,4 +48,12 @@
     protected override void UpdateControls() {
       base.UpdateControls();
+      if(this.scalingFactor == null) {
+        this.scalingFactor = new double[Dataset.Columns];
+        this.scalingOffset = new double[Dataset.Columns];
+        for(int i = 0; i < scalingFactor.Length; i++) {
+          scalingFactor[i] = 1.0;
+          scalingOffset[i] = 0.0;
+        }
+      }
       if (Dataset != null) {
         int rows = Dataset.Rows;
@@ -63,14 +69,10 @@
           }
         }
-        if (Dataset.VariableNames.Length == dataGridView.Columns.Count) {
-          for (int i = 0; i < columns; i++) {
-            dataGridView.Columns[i].Name = Dataset.VariableNames[i];
-          }
-        } else {
-          for (int i = 0; i < columns; i++) {
-            dataGridView.Columns[i].Name = "Var" + i;
-          }
+        for (int i = 0; i < columns; i++) {
+          dataGridView.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;
+          dataGridView.Columns[i].Name = GetColumnName(i);
+          dataGridView.Columns[i].ContextMenuStrip = contextMenuStrip;
         }
-
+        dataGridView.SelectionMode = DataGridViewSelectionMode.ColumnHeaderSelect;
       } else {
         rowsTextBox.Text = "1";
@@ -104,4 +106,47 @@
       return element != null && double.TryParse(element, out result);
     }
+
+    private void exportButton_Click(object sender, EventArgs e) {
+      throw new NotImplementedException();
+    }
+
+    private void scaleValuesToolStripMenuItem_Click(object sender, EventArgs e) {
+      foreach(DataGridViewColumn column in dataGridView.SelectedColumns) {
+        if(scalingFactor[column.Index] == 1.0) {
+          double min = Dataset.GetMinimum(column.Index);
+          double max = Dataset.GetMaximum(column.Index);
+          double range = max - min;
+          scalingFactor[column.Index] = range;
+          scalingOffset[column.Index] = min;
+          column.Name = GetColumnName(column.Index) + " [scaled]";
+          for(int i = 0; i < Dataset.Rows; i++) {
+            Dataset.SetValue(i, column.Index, (Dataset.GetValue(i, column.Index)-min) / range);
+          }
+        }
+      }
+      Refresh();
+    }
+
+    private void originalValuesToolStripMenuItem_Click(object sender, EventArgs e) {
+      foreach(DataGridViewColumn column in dataGridView.SelectedColumns) {
+        if(scalingFactor[column.Index] != 1.0) {
+          column.Name = GetColumnName(column.Index);
+          for(int i = 0; i < Dataset.Rows; i++) {
+            Dataset.SetValue(i, column.Index, Dataset.GetValue(i, column.Index) * scalingFactor[column.Index] + scalingOffset[column.Index]);
+          }
+          scalingFactor[column.Index] = 1.0;
+          scalingOffset[column.Index] = 0.0;
+        }
+      }
+      Refresh();      
+    }
+
+    private string GetColumnName(int index) {
+      if(Dataset.VariableNames.Length == dataGridView.Columns.Count) {
+        return Dataset.VariableNames[index];
+      } else {
+        return "Var " + index;
+      }
+    }
   }
 }
Index: trunk/sources/HeuristicLab.DataAnalysis/DatasetView.designer.cs
===================================================================
--- trunk/sources/HeuristicLab.DataAnalysis/DatasetView.designer.cs	(revision 207)
+++ trunk/sources/HeuristicLab.DataAnalysis/DatasetView.designer.cs	(revision 232)
@@ -45,4 +45,5 @@
     /// </summary>
     private void InitializeComponent() {
+      this.components = new System.ComponentModel.Container();
       this.rowsTextBox = new System.Windows.Forms.TextBox();
       this.columnsTextBox = new System.Windows.Forms.TextBox();
@@ -52,10 +53,15 @@
       this.nameLabel = new System.Windows.Forms.Label();
       this.nameTextBox = new System.Windows.Forms.TextBox();
+      this.exportButton = new System.Windows.Forms.Button();
+      this.contextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+      this.scaleValuesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.originalValuesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
       ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).BeginInit();
+      this.contextMenuStrip.SuspendLayout();
       this.SuspendLayout();
       // 
       // rowsTextBox
       // 
-      this.rowsTextBox.Location = new System.Drawing.Point(46, 32);
+      this.rowsTextBox.Location = new System.Drawing.Point(50, 29);
       this.rowsTextBox.Name = "rowsTextBox";
       this.rowsTextBox.ReadOnly = true;
@@ -65,5 +71,5 @@
       // columnsTextBox
       // 
-      this.columnsTextBox.Location = new System.Drawing.Point(208, 32);
+      this.columnsTextBox.Location = new System.Drawing.Point(217, 29);
       this.columnsTextBox.Name = "columnsTextBox";
       this.columnsTextBox.ReadOnly = true;
@@ -79,7 +85,7 @@
                   | System.Windows.Forms.AnchorStyles.Right)));
       this.dataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize;
-      this.dataGridView.Location = new System.Drawing.Point(3, 58);
+      this.dataGridView.Location = new System.Drawing.Point(3, 84);
       this.dataGridView.Name = "dataGridView";
-      this.dataGridView.Size = new System.Drawing.Size(554, 482);
+      this.dataGridView.Size = new System.Drawing.Size(554, 456);
       this.dataGridView.TabIndex = 3;
       this.dataGridView.CellValidating += new System.Windows.Forms.DataGridViewCellValidatingEventHandler(this.dataGridView_CellValidating);
@@ -88,5 +94,5 @@
       // 
       this.rowsLabel.AutoSize = true;
-      this.rowsLabel.Location = new System.Drawing.Point(3, 35);
+      this.rowsLabel.Location = new System.Drawing.Point(3, 32);
       this.rowsLabel.Name = "rowsLabel";
       this.rowsLabel.Size = new System.Drawing.Size(37, 13);
@@ -97,5 +103,5 @@
       // 
       this.columnsLabel.AutoSize = true;
-      this.columnsLabel.Location = new System.Drawing.Point(152, 35);
+      this.columnsLabel.Location = new System.Drawing.Point(161, 32);
       this.columnsLabel.Name = "columnsLabel";
       this.columnsLabel.Size = new System.Drawing.Size(50, 13);
@@ -114,9 +120,41 @@
       // nameTextBox
       // 
-      this.nameTextBox.Location = new System.Drawing.Point(46, 3);
+      this.nameTextBox.Location = new System.Drawing.Point(50, 3);
       this.nameTextBox.Name = "nameTextBox";
       this.nameTextBox.ReadOnly = true;
-      this.nameTextBox.Size = new System.Drawing.Size(262, 20);
+      this.nameTextBox.Size = new System.Drawing.Size(219, 20);
       this.nameTextBox.TabIndex = 7;
+      // 
+      // exportButton
+      // 
+      this.exportButton.Location = new System.Drawing.Point(6, 55);
+      this.exportButton.Name = "exportButton";
+      this.exportButton.Size = new System.Drawing.Size(75, 23);
+      this.exportButton.TabIndex = 11;
+      this.exportButton.Text = "Export ...";
+      this.exportButton.UseVisualStyleBackColor = true;
+      this.exportButton.Click += new System.EventHandler(this.exportButton_Click);
+      // 
+      // contextMenuStrip
+      // 
+      this.contextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.scaleValuesToolStripMenuItem,
+            this.originalValuesToolStripMenuItem});
+      this.contextMenuStrip.Name = "contextMenuStrip";
+      this.contextMenuStrip.Size = new System.Drawing.Size(146, 48);
+      // 
+      // scaleValuesToolStripMenuItem
+      // 
+      this.scaleValuesToolStripMenuItem.Name = "scaleValuesToolStripMenuItem";
+      this.scaleValuesToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
+      this.scaleValuesToolStripMenuItem.Text = "Scale values";
+      this.scaleValuesToolStripMenuItem.Click += new System.EventHandler(this.scaleValuesToolStripMenuItem_Click);
+      // 
+      // originalValuesToolStripMenuItem
+      // 
+      this.originalValuesToolStripMenuItem.Name = "originalValuesToolStripMenuItem";
+      this.originalValuesToolStripMenuItem.Size = new System.Drawing.Size(145, 22);
+      this.originalValuesToolStripMenuItem.Text = "Unscale values";
+      this.originalValuesToolStripMenuItem.Click += new System.EventHandler(this.originalValuesToolStripMenuItem_Click);
       // 
       // DatasetView
@@ -125,4 +163,5 @@
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
       this.Controls.Add(this.nameTextBox);
+      this.Controls.Add(this.exportButton);
       this.Controls.Add(this.nameLabel);
       this.Controls.Add(this.columnsLabel);
@@ -134,4 +173,5 @@
       this.Size = new System.Drawing.Size(560, 543);
       ((System.ComponentModel.ISupportInitialize)(this.dataGridView)).EndInit();
+      this.contextMenuStrip.ResumeLayout(false);
       this.ResumeLayout(false);
       this.PerformLayout();
@@ -148,4 +188,8 @@
     private System.Windows.Forms.Label nameLabel;
     private System.Windows.Forms.TextBox nameTextBox;
+    private System.Windows.Forms.Button exportButton;
+    private System.Windows.Forms.ContextMenuStrip contextMenuStrip;
+    private System.Windows.Forms.ToolStripMenuItem scaleValuesToolStripMenuItem;
+    private System.Windows.Forms.ToolStripMenuItem originalValuesToolStripMenuItem;
   }
 }
Index: trunk/sources/HeuristicLab.DataAnalysis/DatasetView.resx
===================================================================
--- trunk/sources/HeuristicLab.DataAnalysis/DatasetView.resx	(revision 207)
+++ trunk/sources/HeuristicLab.DataAnalysis/DatasetView.resx	(revision 232)
@@ -118,3 +118,6 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
+  <metadata name="contextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
 </root>
