Index: trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChart.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChart.cs	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChart.cs	(revision 566)
@@ -52,4 +52,5 @@
     private ResultList results;
     private Dictionary<IPrimitive, Record> primitiveToRecordDictionary;
+    private Dictionary<Record, IPrimitive> recordToPrimitiveDictionary;
     private Random random = new Random();
     private Group points;
@@ -59,6 +60,17 @@
       records = new List<Record>();
       primitiveToRecordDictionary = new Dictionary<IPrimitive, Record>();
+      recordToPrimitiveDictionary = new Dictionary<Record, IPrimitive>();
       this.results = results;
+      foreach(Record r in results.Records) {
+        records.Add(r);
+        r.OnSelectionChanged += new EventHandler(Record_OnSelectionChanged);
+      }
       results.OnRecordAdded += new EventHandler<RecordAddedEventArgs>(results_OnRecordAdded);
+      results.Changed += new EventHandler(results_Changed);
+    }
+
+    void results_Changed(object sender, EventArgs e) {
+      Repaint();
+      EnforceUpdate();
     }
 
@@ -76,35 +88,24 @@
     void Record_OnSelectionChanged(object sender, EventArgs e) {
       Record r = (Record)sender;
-      foreach(KeyValuePair<IPrimitive, Record> pair in primitiveToRecordDictionary) {
-        if(pair.Value == r) {
-          IPrimitive primitive = pair.Key;
-          if(r.Selected) {
-            int alpha = primitive.Pen.Color.A;
-            primitive.Pen.Color = Color.FromArgb(alpha, selectionColor);
-            primitive.Brush = primitive.Pen.Brush;
-            primitive.IntoForeground();
-          } else {
-            int alpha = primitive.Pen.Color.A;
-            primitive.Pen.Color = Color.FromArgb(alpha, defaultColor);
-            primitive.Brush = primitive.Pen.Brush;
-            primitive.IntoBackground();
-          }
-          primitive.EnforceUpdate();
-        }
-      }
-    }
-
-    //public void AddDimension(string name) {
-    //  dimensions.Add(name);
-    //  values.Add(name, new List<double>());
-    //}
-    //public void RemoveDimension(string name) {
-    //  dimensions.Remove(name);
-    //  values.Remove(name);
-    //}
-
-    //public void AddDataPoint(string dimension, double value) {
-    //  values[dimension].Add(value);
-    //}
+      IPrimitive primitive;
+      recordToPrimitiveDictionary.TryGetValue(r, out primitive);
+      if(primitive != null) {
+        ((FixedSizeCircle)primitive).UpdateEnabled = false;
+        points.UpdateEnabled = false;
+        if(r.Selected) {
+          int alpha = primitive.Pen.Color.A;
+          primitive.Pen.Color = Color.FromArgb(alpha, selectionColor);
+          primitive.Brush = primitive.Pen.Brush;
+          primitive.IntoForeground();
+        } else {
+          int alpha = primitive.Pen.Color.A;
+          primitive.Pen.Color = Color.FromArgb(alpha, defaultColor);
+          primitive.Brush = primitive.Pen.Brush;
+          primitive.IntoBackground();
+        }
+        ((FixedSizeCircle)primitive).UpdateEnabled = true;
+        points.UpdateEnabled = true;
+      }
+    }
 
     public void SetBubbleSizeDimension(string dimension, bool inverted) {
@@ -133,4 +134,5 @@
 
     private void Repaint() {
+      if(xDimension == null || yDimension == null) return;
       lock(records) {
         double maxSize = 1;
@@ -144,10 +146,11 @@
         Group.Clear();
         primitiveToRecordDictionary.Clear();
+        recordToPrimitiveDictionary.Clear();
         points = new Group(this);
         Group.Add(new Axis(this, 0, 0, AxisType.Both));
         UpdateViewSize(0, 0, 5);
         foreach(Record r in records) {
-          double x = r.Get(xDimension) + (random.NextDouble() * 2.0 - 1.0) * xJitterFactor;
-          double y = r.Get(yDimension) + (random.NextDouble() * 2.0 - 1.0) * yJitterFactor;
+          double x = r.Get(xDimension) + r.Get(Record.X_JITTER) * xJitterFactor;
+          double y = r.Get(yDimension) + r.Get(Record.Y_JITTER) * yJitterFactor;
           int size = CalculateSize(r.Get(sizeDimension), minSize, maxSize);
 
@@ -157,5 +160,5 @@
             UpdateViewSize(x, y, size);
             int alpha = CalculateAlpha(size);
-            Pen pen = new Pen(Color.FromArgb(alpha, defaultColor));
+            Pen pen = new Pen(Color.FromArgb(alpha, r.Selected ? selectionColor: defaultColor));
             Brush brush = pen.Brush;
             FixedSizeCircle c = new FixedSizeCircle(this, x, y, size, pen, brush);
@@ -163,4 +166,5 @@
             points.Add(c);
             primitiveToRecordDictionary[c] = r;
+            recordToPrimitiveDictionary[r] = c;
           }
         }
@@ -223,4 +227,5 @@
           primitiveToRecordDictionary.TryGetValue(p, out r);
           if(r != null) r.ToggleSelected();
+          results.FireChanged();
         }
       } else base.MouseClick(point, button);
@@ -237,4 +242,28 @@
       } else base.MouseDoubleClick(point, button);
     }
+
+    public override void MouseDrag(Point start, Point end, MouseButtons button) {
+      if(button == MouseButtons.Left && Mode == ChartMode.Select) {
+        PointD a = TransformPixelToWorld(start);
+        PointD b = TransformPixelToWorld(end);
+        double minX = Math.Min(a.X, b.X);
+        double minY = Math.Min(a.Y, b.Y);
+        double maxX = Math.Max(a.X, b.X);
+        double maxY = Math.Max(a.Y, b.Y);
+        HeuristicLab.Charting.Rectangle r = new HeuristicLab.Charting.Rectangle(this, minX, minY, maxX, maxY);
+
+        List<IPrimitive> primitives = new List<IPrimitive>();
+        primitives.AddRange(points.Primitives);
+
+        foreach(FixedSizeCircle p in primitives) {
+          if(r.ContainsPoint(p.Point)) {
+            primitiveToRecordDictionary[p].ToggleSelected();
+          }
+        }
+        results.FireChanged();
+      } else {
+        base.MouseDrag(start, end, button);
+      }
+    }
   }
 }
Index: trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.Designer.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.Designer.cs	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.Designer.cs	(revision 566)
@@ -32,5 +32,5 @@
     /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
     protected override void Dispose(bool disposing) {
-      if (disposing && (components != null)) {
+      if(disposing && (components != null)) {
         components.Dispose();
       }
@@ -45,14 +45,63 @@
     /// </summary>
     private void InitializeComponent() {
-      System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(BubbleChartControl));
+      this.components = new System.ComponentModel.Container();
+      this.pictureBox = new System.Windows.Forms.PictureBox();
+      this.pictureBoxContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components);
+      this.zoomToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+      this.toolStripMenuItem2 = new System.Windows.Forms.ToolStripSeparator();
+      this.toolTip = new System.Windows.Forms.ToolTip(this.components);
       ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).BeginInit();
+      this.pictureBoxContextMenuStrip.SuspendLayout();
       this.SuspendLayout();
       // 
       // pictureBox
       // 
-      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)));
-      this.pictureBox.Dock = System.Windows.Forms.DockStyle.Fill;
-      this.pictureBox.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox.Image")));
-      this.pictureBox.Size = new System.Drawing.Size(300, 263);
+      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
+                  | System.Windows.Forms.AnchorStyles.Left)
+                  | System.Windows.Forms.AnchorStyles.Right)));
+      this.pictureBox.BackColor = System.Drawing.Color.White;
+      this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
+      this.pictureBox.ContextMenuStrip = this.pictureBoxContextMenuStrip;
+      this.pictureBox.Location = new System.Drawing.Point(0, 0);
+      this.pictureBox.Name = "pictureBox";
+      this.pictureBox.Size = new System.Drawing.Size(266, 236);
+      this.pictureBox.TabIndex = 0;
+      this.pictureBox.TabStop = false;
+      this.pictureBox.VisibleChanged += new System.EventHandler(this.pictureBox_VisibleChanged);
+      this.pictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseMove);
+      this.pictureBox.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseDoubleClick);
+      this.pictureBox.MouseClick += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseClick);
+      this.pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseDown);
+      this.pictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseUp);
+      this.pictureBox.SizeChanged += new System.EventHandler(this.pictureBox_SizeChanged);
+      // 
+      // pictureBoxContextMenuStrip
+      // 
+      this.pictureBoxContextMenuStrip.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
+            this.zoomToolStripMenuItem,
+            this.selectToolStripMenuItem,
+            this.toolStripMenuItem2});
+      this.pictureBoxContextMenuStrip.Name = "pictureBoxContextMenuStrip";
+      this.pictureBoxContextMenuStrip.Size = new System.Drawing.Size(104, 54);
+      // 
+      // zoomToolStripMenuItem
+      // 
+      this.zoomToolStripMenuItem.Name = "zoomToolStripMenuItem";
+      this.zoomToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
+      this.zoomToolStripMenuItem.Text = "&Zoom";
+      this.zoomToolStripMenuItem.Click += new System.EventHandler(this.zoomToolStripMenuItem_Click);
+      // 
+      // selectToolStripMenuItem
+      // 
+      this.selectToolStripMenuItem.Name = "selectToolStripMenuItem";
+      this.selectToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
+      this.selectToolStripMenuItem.Text = "&Select";
+      this.selectToolStripMenuItem.Click += new System.EventHandler(this.selectToolStripMenuItem_Click);
+      // 
+      // toolStripMenuItem2
+      // 
+      this.toolStripMenuItem2.Name = "toolStripMenuItem2";
+      this.toolStripMenuItem2.Size = new System.Drawing.Size(100, 6);
       // 
       // BubbleChartControl
@@ -60,8 +109,10 @@
       this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
       this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
+      this.BackColor = System.Drawing.SystemColors.Control;
+      this.Controls.Add(this.pictureBox);
       this.Name = "BubbleChartControl";
-      this.Size = new System.Drawing.Size(300, 263);
-      this.Controls.SetChildIndex(this.pictureBox, 0);
+      this.Size = new System.Drawing.Size(266, 236);
       ((System.ComponentModel.ISupportInitialize)(this.pictureBox)).EndInit();
+      this.pictureBoxContextMenuStrip.ResumeLayout(false);
       this.ResumeLayout(false);
 
@@ -70,4 +121,11 @@
     #endregion
 
+    protected System.Windows.Forms.PictureBox pictureBox;
+    protected System.Windows.Forms.ToolTip toolTip;
+    protected System.Windows.Forms.ContextMenuStrip pictureBoxContextMenuStrip;
+    protected System.Windows.Forms.ToolStripMenuItem zoomToolStripMenuItem;
+    protected System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
+    protected System.Windows.Forms.ToolStripSeparator toolStripMenuItem2;
+
   }
 }
Index: trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.cs	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.cs	(revision 566)
@@ -24,4 +24,5 @@
 using System.ComponentModel;
 using System.Drawing;
+using System.Drawing.Drawing2D;
 using System.Data;
 using System.Text;
@@ -30,24 +31,146 @@
 
 namespace HeuristicLab.CEDMA.Charting {
-  public partial class BubbleChartControl : ChartControl {
-    public new BubbleChart Chart {
-      get { return (BubbleChart)base.Chart; }
+  public partial class BubbleChartControl : UserControl {
+    private Bitmap bitmap;
+    private bool renderingRequired;
+    private Point buttonDownPoint;
+    private Point mousePosition;
+    private int mouseClickCount;
+    private DateTime lastRendered = DateTime.Now;
+    private BubbleChart myChart;
+    public BubbleChart Chart {
+      get { return myChart; }
       set {
-        if (Chart != null) {
-          Chart.Update -= new EventHandler(Chart_Update);
+        if(myChart != null) myChart.Update -= new EventHandler(myChart_Update);
+        myChart = value;
+        if(myChart != null) {
+          myChart.Update += new EventHandler(myChart_Update);
+          SetMode(Chart.Mode);
         }
-        base.Chart = value;
-        if (Chart != null) {
-          Chart.Update += new EventHandler(Chart_Update);
-        }
+        GenerateImage();
       }
     }
-
-    void Chart_Update(object sender, EventArgs e) {
-      // do nothing;
+    private bool myScaleOnResize;
+    public bool ScaleOnResize {
+      get { return myScaleOnResize; }
+      set { myScaleOnResize = value; }
     }
 
     public BubbleChartControl() {
       InitializeComponent();
+      myScaleOnResize = true;
+      GenerateImage();
+    }
+
+    private void myChart_Update(object sender, EventArgs e) {
+      GenerateImage();
+    }
+    private void pictureBox_SizeChanged(object sender, EventArgs e) {
+      if(ScaleOnResize) {
+        if((pictureBox.Width > 0) && (pictureBox.Height > 0) && (Chart != null)) {
+          PointD point = Chart.TransformPixelToWorld(new Point(pictureBox.Width, Chart.SizeInPixels.Height - pictureBox.Height));
+          Chart.SetPosition(Chart.LowerLeft, point);
+        }
+      }
+      GenerateImage();
+    }
+    private void pictureBox_VisibleChanged(object sender, EventArgs e) {
+      if(pictureBox.Visible && renderingRequired) {
+        GenerateImage();
+      }
+    }
+
+    private void pictureBox_MouseDown(object sender, MouseEventArgs e) {
+      buttonDownPoint = e.Location;
+      mouseClickCount = e.Clicks;
+    }
+    private void pictureBox_MouseUp(object sender, MouseEventArgs e) {
+      if(e.Button == MouseButtons.Left) {
+        Point lowerLeft = new Point(Math.Min(e.X, buttonDownPoint.X),
+                                    Math.Max(e.Y, buttonDownPoint.Y));
+        Point upperRight = new Point(Math.Max(e.X, buttonDownPoint.X),
+                                     Math.Min(e.Y, buttonDownPoint.Y));
+        if(Chart.Mode == ChartMode.Zoom) {
+          pictureBox.Refresh();
+          if((lowerLeft.X != upperRight.X) && (lowerLeft.Y != upperRight.Y)) {
+            Chart.ZoomIn(lowerLeft, upperRight);
+          }
+        } else if(Chart.Mode == ChartMode.Select) {
+          if((lowerLeft.X != upperRight.X) && (lowerLeft.Y != upperRight.Y)) {
+            Chart.MouseDrag(lowerLeft, upperRight, e.Button);
+          }
+        }
+      } else if(e.Button == MouseButtons.Middle) {
+        if(Chart.Mode == ChartMode.Zoom) {
+          if(mouseClickCount == 1) Chart.ZoomOut();
+          else if(mouseClickCount == 2) Chart.Unzoom();
+        }
+      }
+    }
+    private void pictureBox_MouseMove(object sender, MouseEventArgs e) {
+      toolTip.SetToolTip(pictureBox, Chart.GetToolTipText(e.Location));
+      Cursor cursor = Chart.GetCursor(e.Location);
+      if(cursor != null) pictureBox.Cursor = cursor;
+      else pictureBox.Cursor = Cursors.Default;
+
+      if(e.Button != MouseButtons.None) {
+        if((Chart.Mode == ChartMode.Zoom || Chart.Mode == ChartMode.Select) && (e.Button == MouseButtons.Left)) {
+          pictureBox.Refresh();
+          Graphics graphics = pictureBox.CreateGraphics();
+          Pen pen = new Pen(Color.Gray);
+          pen.DashStyle = DashStyle.Dash;
+          graphics.DrawRectangle(pen,
+                                 Math.Min(e.X, buttonDownPoint.X),
+                                 Math.Min(e.Y, buttonDownPoint.Y),
+                                 Math.Abs(e.X - buttonDownPoint.X),
+                                 Math.Abs(e.Y - buttonDownPoint.Y));
+          pen.Dispose();
+          graphics.Dispose();
+        }
+      }
+      mousePosition = e.Location;
+    }
+
+    private void zoomToolStripMenuItem_Click(object sender, EventArgs e) {
+      SetMode(ChartMode.Zoom);
+    }
+    private void selectToolStripMenuItem_Click(object sender, EventArgs e) {
+      SetMode(ChartMode.Select);
+    }
+
+    private void GenerateImage() {
+      if(!Visible) {
+        renderingRequired = true;
+      } else {
+        if((pictureBox.Width == 0) || (pictureBox.Height == 0)) {
+          bitmap = null;
+        } else {
+          bitmap = new Bitmap(pictureBox.Width, pictureBox.Height);
+          if(Chart != null) {
+            Graphics graphics = Graphics.FromImage(bitmap);
+            graphics.SetClip(new System.Drawing.Rectangle(0, 0, pictureBox.Width, pictureBox.Height));
+            Chart.Render(graphics, pictureBox.Width, pictureBox.Height);
+            graphics.Dispose();
+          }
+        }
+        pictureBox.Image = bitmap;
+        renderingRequired = false;
+      }
+    }
+
+    private void SetMode(ChartMode mode) {
+      zoomToolStripMenuItem.Checked = false;
+      selectToolStripMenuItem.Checked = false;
+      if(mode == ChartMode.Zoom) zoomToolStripMenuItem.Checked = true;
+      else if(mode == ChartMode.Select) selectToolStripMenuItem.Checked = true;
+      Chart.Mode = mode;
+    }
+
+    private void pictureBox_MouseClick(object sender, MouseEventArgs e) {
+      Chart.MouseClick(e.Location, e.Button);
+    }
+
+    private void pictureBox_MouseDoubleClick(object sender, MouseEventArgs e) {
+      Chart.MouseDoubleClick(e.Location, e.Button);
     }
   }
Index: trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.resx
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.resx	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/BubbleChartControl.resx	(revision 566)
@@ -118,35 +118,7 @@
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
   </resheader>
-  <assembly alias="System.Drawing" name="System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
-  <data name="pictureBox.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
-    <value>
-        iVBORw0KGgoAAAANSUhEUgAAASwAAAEHCAYAAAAUFnuAAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
-        YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAABXlJREFUeF7t0DEB
-        AAAAwqD1T20JT4hAYcCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMG
-        DBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCA
-        AQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgwYMCAAQMGDBgw
-        YMCAAQMGDBi4DAzSEwABKB1lLgAAAABJRU5ErkJggg==
-</value>
-  </data>
+  <metadata name="pictureBoxContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
+    <value>17, 17</value>
+  </metadata>
   <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     <value>210, 17</value>
Index: trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/HeuristicLab.CEDMA.Charting.csproj	(revision 566)
@@ -73,4 +73,5 @@
       <DependentUpon>BubbleChartControl.cs</DependentUpon>
     </Compile>
+    <Compile Include="Record.cs" />
     <Compile Include="HeuristicLabCedmaChartingPlugin.cs" />
     <Compile Include="Histogram.cs" />
Index: trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs	(revision 566)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/Record.cs	(revision 566)
@@ -0,0 +1,102 @@
+﻿#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+#region License Information
+/* HeuristicLab
+ * Copyright (C) 2002-2008 Heuristic and Evolutionary Algorithms Laboratory (HEAL)
+ *
+ * This file is part of HeuristicLab.
+ *
+ * HeuristicLab is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * HeuristicLab is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with HeuristicLab. If not, see <http://www.gnu.org/licenses/>.
+ */
+#endregion
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using HeuristicLab.Core;
+using System.Collections;
+using HeuristicLab.CEDMA.DB.Interfaces;
+using System.Xml;
+using System.Runtime.Serialization;
+using System.IO;
+using HeuristicLab.PluginInfrastructure;
+
+namespace HeuristicLab.CEDMA.Charting {
+  public class Record {
+    public const string MAPE_TRAINING = "MAPE (training)";
+    public const string MAPE_VALIDATION = "MAPE (validation)";
+    public const string MAPE_TEST = "MAPE (test)";
+    public const string R2_TRAINING = "R2 (training)";
+    public const string R2_VALIDATION = "R2 (validation)";
+    public const string R2_TEST = "R2 (test)";
+    public const string TARGET_VARIABLE = "Target variable";
+    public const string TREE_SIZE = "Tree size";
+    public const string TREE_HEIGHT = "Tree height";
+
+    public const string X_JITTER = "__X_JITTER";
+    public const string Y_JITTER = "__Y_JITTER";
+
+    private Dictionary<string, double> values = new Dictionary<string, double>();
+    public Dictionary<string, double> Values {
+      get {
+        return values;
+      }
+    }
+
+    private bool selected = false;
+    public bool Selected { get { return selected; } }
+
+    private string uri;
+    public string Uri { get { return uri; } }
+    public Record(string uri) {
+      this.uri = uri;
+    }
+
+    public void Set(string name, double value) {
+      Values.Add(name, value);
+    }
+
+    public double Get(string name) {
+      if(name == null || !Values.ContainsKey(name)) return double.NaN;
+      return Values[name];
+    }
+
+    public void ToggleSelected() {
+      selected = !selected;
+      if(OnSelectionChanged != null) OnSelectionChanged(this, new EventArgs());
+    }
+
+    public event EventHandler OnSelectionChanged;
+  }
+}
Index: trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/ResultList.cs	(revision 566)
@@ -33,37 +33,4 @@
 
 namespace HeuristicLab.CEDMA.Charting {
-  public class Record {
-    private Dictionary<string, double> values = new Dictionary<string, double>();
-    public Dictionary<string,double> Values {
-      get {
-        return values;
-      }
-    }
-
-    private bool selected = false;
-    public bool Selected { get { return selected; } }
-
-    private string uri;
-    public string Uri { get { return uri; } }
-    public Record(string uri) {
-      this.uri = uri;
-    }
-
-    public void Set(string name, double value) {
-      Values.Add(name, value);
-    }
-
-    public double Get(string name) {
-      if(name==null || !Values.ContainsKey(name)) return double.NaN;
-      return Values[name];
-    }
-
-    public void ToggleSelected() {
-      selected = !selected;
-      if(OnSelectionChanged != null) OnSelectionChanged(this, new EventArgs());
-    }
-
-    public event EventHandler OnSelectionChanged;
-  }
 
   public class RecordAddedEventArgs : EventArgs {
@@ -78,15 +45,4 @@
   public class ResultList : ItemBase {
     private const string cedmaNS = "http://www.heuristiclab.com/cedma/";
-
-    private const string MAPE_TRAINING = "MAPE (training)";
-    private const string MAPE_VALIDATION = "MAPE (validation)";
-    private const string MAPE_TEST = "MAPE (test)";
-    private const string R2_TRAINING = "R2 (training)";
-    private const string R2_VALIDATION = "R2 (validation)";
-    private const string R2_TEST = "R2 (test)";
-    private const string TARGET_VARIABLE = "Target variable";
-    private const string TREE_SIZE = "Tree size";
-    private const string TREE_HEIGHT = "Tree height";
-
     private readonly Entity targetVariablePredicate = new Entity(cedmaNS + "TargetVariable");
     private readonly Entity trainingMAPEPredicate = new Entity(cedmaNS + "MeanAbsolutePercentageErrorTraining");
@@ -111,7 +67,7 @@
     }
 
-    private List<string> variableNames = new List<string>() { TARGET_VARIABLE, TREE_SIZE, TREE_HEIGHT,
-    MAPE_TRAINING, MAPE_VALIDATION, MAPE_TEST,
-    R2_TRAINING, R2_VALIDATION, R2_TEST};
+    private List<string> variableNames = new List<string>() { Record.TARGET_VARIABLE, Record.TREE_SIZE, Record.TREE_HEIGHT,
+    Record.MAPE_TRAINING, Record.MAPE_VALIDATION, Record.MAPE_TEST,
+    Record.R2_TRAINING, Record.R2_VALIDATION, Record.R2_TEST};
     public string[] VariableNames {
       get {
@@ -120,8 +76,18 @@
     }
 
+    private Dictionary<Entity, string> predicateToVariableName;
+
     public event EventHandler<RecordAddedEventArgs> OnRecordAdded;
 
     private List<Record> records;
-
+    public List<Record> Records {
+      get {
+        List<Record> result = new List<Record>();
+        lock(records) {
+          result.AddRange(records);
+        }
+        return result;
+      }
+    }
     private void ReloadList() {
       var results = store.Select(new Statement(anyEntity, new Entity(cedmaNS + "instanceOf"), new Literal("class:GpFunctionTree")))
@@ -133,32 +99,28 @@
           new Resource[] { anyEntity })));
 
+      Random random = new Random();
       foreach(Statement[] ss in results) {
         if(ss.Length > 0) {
           Record r = new Record(ss[0].Subject.Uri);
+          r.Set(Record.X_JITTER, random.NextDouble() * 2.0 - 1.0);
+          r.Set(Record.Y_JITTER, random.NextDouble() * 2.0 - 1.0);
           foreach(Statement s in ss) {
-            if(s.Predicate.Equals(targetVariablePredicate)) {
-              r.Set(TARGET_VARIABLE, (double)(int)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(treeSizePredicate)) {
-              r.Set(TREE_SIZE, (double)(int)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(treeHeightPredicate)) {
-              r.Set(TREE_HEIGHT, (double)(int)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(trainingMAPEPredicate)) {
-              r.Set(MAPE_TRAINING, (double)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(validationMAPEPredicate)) {
-              r.Set(MAPE_VALIDATION, (double)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(testMAPEPredicate)) {
-              r.Set(MAPE_TEST, (double)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(trainingR2Predicate)) {
-              r.Set(R2_TRAINING, (double)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(validationR2Predicate)) {
-              r.Set(R2_VALIDATION, (double)((Literal)s.Property).Value);
-            } else if(s.Predicate.Equals(testR2Predicate)) {
-              r.Set(R2_TEST, (double)((Literal)s.Property).Value);
+            string varName;
+            predicateToVariableName.TryGetValue(s.Predicate, out varName);
+            if(varName != null) {
+              if(varName == Record.TREE_HEIGHT || varName == Record.TREE_SIZE || varName == Record.TARGET_VARIABLE) {
+                r.Set(varName, (double)(int)((Literal)s.Property).Value);
+              } else {
+                r.Set(varName, (double)((Literal)s.Property).Value);
+              }
             }
           }
-          records.Add(r);
+          lock(records) {
+            records.Add(r);
+          }
           FireRecordAdded(r);
         }
       }
+      FireChanged();
     }
 
@@ -170,4 +132,14 @@
       : base() {
       records = new List<Record>();
+      predicateToVariableName = new Dictionary<Entity, string>();
+      predicateToVariableName[targetVariablePredicate] = Record.TARGET_VARIABLE;
+      predicateToVariableName[treeSizePredicate] = Record.TREE_SIZE;
+      predicateToVariableName[treeHeightPredicate] = Record.TREE_HEIGHT;
+      predicateToVariableName[trainingMAPEPredicate] = Record.MAPE_TRAINING;
+      predicateToVariableName[validationMAPEPredicate] = Record.MAPE_VALIDATION;
+      predicateToVariableName[testMAPEPredicate] = Record.MAPE_TEST;
+      predicateToVariableName[trainingR2Predicate] = Record.R2_TRAINING;
+      predicateToVariableName[validationR2Predicate] = Record.R2_VALIDATION;
+      predicateToVariableName[testR2Predicate] = Record.R2_TEST;
     }
 
Index: trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs
===================================================================
--- trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs	(revision 565)
+++ trunk/sources/HeuristicLab.CEDMA.Charting/ResultListView.cs	(revision 566)
@@ -22,5 +22,4 @@
     public ResultListView(ResultList results) {
       this.results = results;
-      results.Changed += new EventHandler(results_Changed);
       InitializeComponent();
       xAxisComboBox.Items.AddRange(results.VariableNames);
@@ -30,11 +29,4 @@
       sizeComboBox.Items.AddRange(results.VariableNames);
       sizeComboBox.SelectedItem = sizeComboBox.Items[0];
-      InitChart();
-    }
-
-    private DateTime lastUpdate = DateTime.Now;
-    void results_Changed(object sender, EventArgs e) {
-      if(DateTime.Now.Subtract(lastUpdate).TotalSeconds < 3) return;
-      lastUpdate = DateTime.Now;
       InitChart();
     }
