Index: trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs	(revision 1048)
+++ trunk/sources/HeuristicLab.Visualization.Test/LineChartTests.cs	(revision 1049)
@@ -28,4 +28,8 @@
       row2.Thickness = 4;
       row3.Thickness = 5;
+
+      row1.Label = "Simon";
+      row2.Label = "Gertschi";
+      row3.Label = "Maxi";
 
       row1.Style = DrawingStyle.Solid;
Index: trunk/sources/HeuristicLab.Visualization/LegendShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LegendShape.cs	(revision 1048)
+++ trunk/sources/HeuristicLab.Visualization/LegendShape.cs	(revision 1049)
@@ -4,48 +4,44 @@
 namespace HeuristicLab.Visualization {
   public class LegendItem {
-    public LegendItem(string label, Color color) {
+    public LegendItem(string label, Color color, int thickness) {
       Label = label;
       Color = color;
+      Thickness = thickness;
     }
 
     public string Label { get; set; }
     public Color Color { get; set; }
+    public int Thickness { get; set; }
   }
 
 
-  public class LegendShape : IShape {
-    private readonly Color color;
+  public class LegendShape : CompositeShape {
+    private RectangleD boundingBox;
+    private Color color;
 
     private readonly IList<LegendItem> legendItems = new List<LegendItem>();
-    private readonly RectangleD rect;
 
     public LegendShape(double x1, double y1, double x2, double y2, double z, Color color) {
-      rect = new RectangleD(x1, y1, x2, y2);
+      boundingBox = new RectangleD(x1, y1, x2, y2);
       Z = z;
       this.color = color;
+      CreateLegend();
     }
 
     public double Z { get; set; }
 
-    #region IShape Members
-
     public RectangleD BoundingBox {
-      get { return rect; }
+      get { return boundingBox; }
+      set { boundingBox = value; }
     }
 
-    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
-      int startY = 10;
-      foreach (LegendItem i in legendItems) {
-        using (Pen pen = new Pen(i.Color, 5)) {
-          graphics.DrawLine(pen, 10, startY+10, 30, startY+10);
-        }
-        using (Brush brush = new SolidBrush(Color.Black)) {
-          graphics.DrawString(i.Label, new Font("Arial", 12), brush, 35, startY);
-        }
-        startY += 15;
+    public void CreateLegend() {
+      double y = boundingBox.Y2;
+      foreach (LegendItem item in legendItems) {
+        AddShape(new LineShape(10, y - 10, 30, y - 10, 0, item.Color, item.Thickness, DrawingStyle.Solid));
+        AddShape(new TextShape(35, y, item.Label));
+        y -= 15;
       }
     }
-
-    #endregion
 
     public void AddLegendItem(LegendItem item) {
Index: trunk/sources/HeuristicLab.Visualization/LineChart.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1048)
+++ trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1049)
@@ -34,4 +34,5 @@
     private readonly TextShape titleShape;
     private readonly LinesShape linesShape;
+    private readonly LegendShape legendShape;
 
     private readonly XAxis xAxis;
@@ -62,4 +63,10 @@
       root.AddShape(linesShape);
 
+      legendShape = new LegendShape(0,0,0,0,0,Color.Black);
+      //legendShape.AddLegendItem(new LegendItem("test", Color.Red, 5));
+      //legendShape.AddLegendItem(new LegendItem("test1", Color.Blue, 5));
+      //legendShape.AddLegendItem(new LegendItem("test2", Color.Pink, 5));
+      root.AddShape(legendShape);
+
       xAxis = new XAxis(dummy, dummy);
       root.AddShape(xAxis);
@@ -67,4 +74,6 @@
       titleShape = new TextShape(0, 0, "Title", 15);
       root.AddShape(titleShape);
+
+
 
       canvas.MainCanvas.WorldShape = root;
@@ -98,4 +107,6 @@
                                          linesShape.BoundingBox.X2,
                                          linesShape.BoundingBox.Y1);
+
+      legendShape.BoundingBox = new RectangleD(10, 10, 110, canvas.Height - 50);
     }
 
@@ -136,4 +147,6 @@
       }
 
+      legendShape.AddLegendItem(new LegendItem(row.Label, row.Color, row.Thickness));
+      legendShape.CreateLegend();
       InitLineShapes(row);
     }
