Index: trunk/sources/HeuristicLab.Visualization/LineChart.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1237)
+++ trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1240)
@@ -12,4 +12,6 @@
 
     private readonly IChartDataRowsModel model;
+    private readonly Canvas canvas;
+
     private int maxDataRowCount;
     private Boolean zoomFullView;
@@ -20,5 +22,4 @@
     private IShape minLineShape;
 
-    private readonly WorldShape root;
     private readonly TextShape titleShape;
     private readonly LinesShape linesShape;
@@ -28,4 +29,7 @@
     private readonly YAxis yAxis;
     private readonly Grid grid;
+
+    private readonly WorldShape berni;
+    private readonly RectangleShape mousePointer;
 
     /// <summary>
@@ -45,38 +49,41 @@
       }
 
-      //TODO: correct Rectangle to fit
-
-      root = new WorldShape();
+      minMaxLineEnabled = true;
+
+      canvas = canvasUI.Canvas;
 
       grid = new Grid();
-      minMaxLineEnabled = true;
-      root.AddShape(grid);
+      canvas.AddShape(grid);
 
       linesShape = new LinesShape();
-      root.AddShape(linesShape);
+      canvas.AddShape(linesShape);
 
       xAxis = new XAxis();
-      root.AddShape(xAxis);
+      canvas.AddShape(xAxis);
 
       yAxis = new YAxis();
-      root.AddShape(yAxis);
+      canvas.AddShape(yAxis);
 
       titleShape = new TextShape(0, 0, model.Title, 15);
-      root.AddShape(titleShape);
+      canvas.AddShape(titleShape);
 
       minMaxLineShape = new MinMaxLineShape(this.minDataValue, this.maxDataValue, Color.Yellow, 4, DrawingStyle.Solid);
-      root.AddShape(minMaxLineShape);
+      canvas.AddShape(minMaxLineShape);
 
       legendShape = new LegendShape();
-      root.AddShape(legendShape);
-
-      canvas.MainCanvas.WorldShape = root;
-      canvas.Resize += delegate { UpdateLayout(); };
-      
-      UpdateLayout();
+      canvas.AddShape(legendShape);
+
+      berni = new WorldShape();
+      canvas.AddShape(berni);
+
+      mousePointer = new RectangleShape(10, 10, 20, 20, Color.Black);
+      berni.AddShape(mousePointer);
+
       maxDataRowCount = 0;
       this.model = model;
       Item = model;
 
+      UpdateLayout();
+      canvasUI.Resize += delegate { UpdateLayout(); };
 
       //The whole data rows are shown per default
@@ -88,8 +95,6 @@
     /// </summary>
     private void UpdateLayout() {
-      root.ClippingArea = new RectangleD(0, 0, canvas.Width, canvas.Height);
-
       titleShape.X = 10;
-      titleShape.Y = canvas.Height - 10;
+      titleShape.Y = canvasUI.Height - 10;
 
       const int yAxisWidth = 100;
@@ -98,6 +103,9 @@
       linesShape.BoundingBox = new RectangleD(yAxisWidth,
                                               xAxisHeight,
-                                              canvas.Width,
-                                              canvas.Height);
+                                              canvasUI.Width,
+                                              canvasUI.Height);
+
+      berni.BoundingBox = linesShape.BoundingBox;
+      berni.ClippingArea = new RectangleD(0, 0, berni.BoundingBox.Width, berni.BoundingBox.Height);
 
       grid.BoundingBox = linesShape.BoundingBox;
@@ -115,5 +123,5 @@
                                          linesShape.BoundingBox.Y1);
 
-      legendShape.BoundingBox = new RectangleD(10, 10, 110, canvas.Height - 50);
+      legendShape.BoundingBox = new RectangleD(10, 10, 110, canvasUI.Height - 50);
       legendShape.ClippingArea = new RectangleD(0, 0, legendShape.BoundingBox.Width,
                                                 legendShape.BoundingBox.Height);
@@ -124,5 +132,5 @@
       ZoomToFullView();
 
-      canvas.Invalidate();
+      canvasUI.Invalidate();
     }
 
@@ -162,4 +170,12 @@
       InitLineShapes(row);
     }
+
+    private void OnDataRowRemoved(IDataRow row) {
+      row.ValueChanged -= OnRowValueChanged;
+      row.ValuesChanged -= OnRowValuesChanged;
+      row.DataRowChanged -= OnDataRowChanged;
+    }
+
+    #endregion
 
     private void ZoomToFullView() {
@@ -221,11 +237,5 @@
       ZoomToFullView();
 
-      canvas.Invalidate();
-    }
-
-    private void OnDataRowRemoved(IDataRow row) {
-      row.ValueChanged -= OnRowValueChanged;
-      row.ValuesChanged -= OnRowValuesChanged;
-      row.DataRowChanged -= OnDataRowChanged;
+      canvasUI.Invalidate();
     }
 
@@ -267,8 +277,8 @@
       ZoomToFullView();
 
-      canvas.Invalidate();
-    }
-
-
+      canvasUI.Invalidate();
+    }
+
+    // TODO remove (see ticket #501)
     public IList<IDataRow> GetRows() {
       return model.Rows;
@@ -286,8 +296,15 @@
       titleShape.Text = model.Title;
 
-      Invalidate();
-    }
-
-    #endregion
+      canvasUI.Invalidate();
+    }
+
+    public void OnDataRowChanged(IDataRow row) {
+      foreach (LineShape ls in rowToLineShapes[row]) {
+        ls.LSColor = row.Color;
+        ls.LSThickness = row.Thickness;
+        ls.LSDrawingStyle = row.Style;
+      }
+      canvasUI.Invalidate();
+    }
 
     #region Begin-/EndUpdate
@@ -307,5 +324,5 @@
 
       if (beginUpdateCount == 0) {
-        canvas.Invalidate();
+        canvasUI.Invalidate();
       }
     }
@@ -325,5 +342,5 @@
 
         SetNewClippingArea(clippingArea);
-        canvas.Invalidate();
+        canvasUI.Invalidate();
       }
     }
@@ -346,4 +363,12 @@
     }
 
+    private void canvas_MouseMove(object sender, MouseEventArgs e) {
+      double x = Transform.ToWorldX(e.X, berni.Viewport, berni.ClippingArea);
+      double y = Transform.ToWorldY(e.Y, berni.Viewport, berni.ClippingArea);
+
+      mousePointer.Rectangle = new RectangleD(x-1, y-1, x+1, y+1);
+      canvasUI.Invalidate();
+    }
+
     private void canvasUI1_MouseWheel(object sender, MouseEventArgs e) {
       if (ModifierKeys == Keys.Control) {
@@ -353,5 +378,5 @@
 
         SetLineClippingArea(clippingArea);
-        canvas.Invalidate();
+        canvasUI.Invalidate();
       }
     }
@@ -362,5 +387,5 @@
       zoomListener.OnMouseUp += OnZoom_MouseUp;
 
-      canvas.MouseEventListener = zoomListener;
+      canvasUI.MouseEventListener = zoomListener;
 
       rectangleShape = new RectangleShape(e.X, e.Y, e.X, e.Y, Color.Blue);
@@ -371,5 +396,5 @@
 
     private void OnZoom_MouseUp(object sender, MouseEventArgs e) {
-      canvas.MouseEventListener = null;
+      canvasUI.MouseEventListener = null;
 
       RectangleD clippingArea = rectangleShape.Rectangle;
@@ -382,22 +407,22 @@
       zoomFullView = false; //user wants to zoom => no full view
 
-      canvas.Invalidate();
+      canvasUI.Invalidate();
     }
 
     private void DrawRectangle(Rectangle rectangle) {
-      rectangleShape.Rectangle = Transform.ToWorld(rectangle, canvas.ClientRectangle, linesShape.ClippingArea);
-      canvas.Invalidate();
+      rectangleShape.Rectangle = Transform.ToWorld(rectangle, canvasUI.ClientRectangle, linesShape.ClippingArea);
+      canvasUI.Invalidate();
     }
 
     private void CreatePanListener(MouseEventArgs e) {
-      PanListener panListener = new PanListener(canvas.ClientRectangle, linesShape.ClippingArea, e.Location);
+      PanListener panListener = new PanListener(canvasUI.ClientRectangle, linesShape.ClippingArea, e.Location);
 
       panListener.SetNewClippingArea += SetNewClippingArea;
       panListener.OnMouseUp += delegate {
                                  historyStack.Push(linesShape.ClippingArea);
-                                 canvas.MouseEventListener = null;
+                                 canvasUI.MouseEventListener = null;
                                };
 
-      canvas.MouseEventListener = panListener;
+      canvasUI.MouseEventListener = panListener;
     }
 
@@ -406,5 +431,5 @@
 
       zoomFullView = false;
-      canvas.Invalidate();
+      canvasUI.Invalidate();
     }
 
@@ -415,13 +440,4 @@
       optionsdlg.ShowDialog(this);
     }
-
-    public void OnDataRowChanged(IDataRow row) {
-      foreach (LineShape ls in rowToLineShapes[row]) {
-        ls.LSColor = row.Color;
-        ls.LSThickness = row.Thickness;
-        ls.LSDrawingStyle = row.Style;
-      }
-      canvas.Invalidate();
-    }
   }
 }
