Index: trunk/sources/HeuristicLab.Visualization.Test/LegendForm.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization.Test/LegendForm.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization.Test/LegendForm.cs	(revision 1233)
@@ -1,4 +1,5 @@
 ﻿using System.Drawing;
 using System.Windows.Forms;
+using HeuristicLab.Visualization.Legend;
 
 namespace HeuristicLab.Visualization.Test {
@@ -9,5 +10,4 @@
 
       CreateLegendShape();
-
     }
 
Index: trunk/sources/HeuristicLab.Visualization/AxisTicks.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/AxisTicks.cs	(revision 1233)
+++ trunk/sources/HeuristicLab.Visualization/AxisTicks.cs	(revision 1233)
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+
+namespace HeuristicLab.Visualization {
+  public static class AxisTicks {
+    public static IEnumerable<double> GetTicks(int pixelsPerInterval, int screenSize, double worldSize, double worldStart) {
+      int intervals = screenSize/pixelsPerInterval;
+
+      if (intervals > 0) {
+        double step = worldSize/intervals;
+        step = Math.Pow(10, Math.Floor(Math.Log10(step)));
+        if (worldSize/(step*5) > intervals)
+          step = step*5;
+        else if (worldSize/(step*2) > intervals)
+          step = step*2;
+
+        for (double x = Math.Floor(worldStart/step)*step;
+             x <= worldStart + worldSize;
+             x += step)
+          yield return x;
+      }
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Visualization/DataRow.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/DataRow.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/DataRow.cs	(revision 1233)
@@ -21,5 +21,5 @@
     private DrawingStyle style = DrawingStyle.Solid;
     private DataRowType lineType = DataRowType.Normal;
-    private List<double> dataRow = new List<double>();
+    private readonly List<double> dataRow = new List<double>();
 
     private ILabelProvider labelProvider = new ContinuousLabelProvider("0.##");
@@ -41,5 +41,4 @@
     }
 
-
     public DataRow() {
     }
@@ -48,5 +47,4 @@
       this.Label = label;
     }
-    
 
     public DataRow(string label, Color color, int thickness, DrawingStyle style, List<double> dataRow) {
@@ -58,7 +56,4 @@
     }
 
-    /// <summary>
-    /// Raised when data row data changed. Should cause redraw in the view.
-    /// </summary>
     public event DataRowChangedHandler DataRowChanged;
 
@@ -130,5 +125,5 @@
         OnValueChanged(value, index, Action.Added);
       } else {
-        throw new System.IndexOutOfRangeException();
+        throw new IndexOutOfRangeException();
       }   
     }
@@ -154,5 +149,5 @@
         OnValuesChanged(values, index, Action.Added);
       } else {
-        throw new System.IndexOutOfRangeException();
+        throw new IndexOutOfRangeException();
       }
     }
@@ -164,5 +159,5 @@
         OnValueChanged(value, index, Action.Modified);
       } else {
-        throw new System.IndexOutOfRangeException();
+        throw new IndexOutOfRangeException();
       }
     }
@@ -180,5 +175,5 @@
         OnValuesChanged(values, startInd, Action.Modified);
       } else {
-        throw new System.IndexOutOfRangeException();
+        throw new IndexOutOfRangeException();
       }
     }
@@ -191,5 +186,5 @@
         OnValueChanged(remVal, index, Action.Deleted);
       } else {
-        throw new System.IndexOutOfRangeException();
+        throw new IndexOutOfRangeException();
       }
     }
@@ -210,8 +205,8 @@
           OnValuesChanged(remValues, index, Action.Deleted);
         } else {
-          throw new System.IndexOutOfRangeException();
+          throw new IndexOutOfRangeException();
         }
       } else {
-        throw new System.Exception("parameter count must be > 0!");
+        throw new Exception("parameter count must be > 0!");
       }
     }
Index: trunk/sources/HeuristicLab.Visualization/Grid.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/Grid.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/Grid.cs	(revision 1233)
@@ -6,21 +6,23 @@
       shapes.Clear();
 
-      foreach (double y in XAxis.GetTicks(YAxis.PixelsPerInterval,
-                                          viewport.Height,
-                                          ClippingArea.Height,
-                                          ClippingArea.Y1)) {
+      foreach (double y in AxisTicks.GetTicks(YAxis.PixelsPerInterval,
+                                              viewport.Height,
+                                              ClippingArea.Height,
+                                              ClippingArea.Y1)) {
         LineShape line = new LineShape(ClippingArea.X1, y,
                                        ClippingArea.X2, y,
-                                       0, Color.LightBlue, 1, DrawingStyle.Dashed);
+                                       Color.LightBlue, 1,
+                                       DrawingStyle.Dashed);
         shapes.Add(line);
       }
 
-      foreach (double x in XAxis.GetTicks(XAxis.PixelsPerInterval,
-                                          viewport.Width,
-                                          ClippingArea.Width,
-                                          ClippingArea.X1)) {
+      foreach (double x in AxisTicks.GetTicks(XAxis.PixelsPerInterval,
+                                              viewport.Width,
+                                              ClippingArea.Width,
+                                              ClippingArea.X1)) {
         LineShape line = new LineShape(x, ClippingArea.Y1,
                                        x, ClippingArea.Y2,
-                                       0, Color.LightBlue, 1, DrawingStyle.Dashed);
+                                       Color.LightBlue, 1,
+                                       DrawingStyle.Dashed);
         shapes.Add(line);
       }
@@ -28,9 +30,11 @@
       LineShape lineZeroX = new LineShape(0, ClippingArea.Y1,
                                           0, ClippingArea.Y2,
-                                          0, Color.LightBlue, 3, DrawingStyle.Dashed);
+                                          Color.LightBlue, 3,
+                                          DrawingStyle.Dashed);
 
       LineShape lineZeroY = new LineShape(ClippingArea.X1, 0,
                                           ClippingArea.X2, 0,
-                                          0, Color.LightBlue, 3, DrawingStyle.Dashed);
+                                          Color.LightBlue, 3,
+                                          DrawingStyle.Dashed);
 
       shapes.Add(lineZeroX);
Index: trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj
===================================================================
--- trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj	(revision 1233)
@@ -68,4 +68,5 @@
   </ItemGroup>
   <ItemGroup>
+    <Compile Include="AxisTicks.cs" />
     <Compile Include="Canvas.cs" />
     <Compile Include="CanvasUI.cs">
@@ -87,4 +88,5 @@
     <Compile Include="LabelProvider\ILabelProvider.cs" />
     <Compile Include="IMouseEventListener.cs" />
+    <Compile Include="Legend\LegendItem.cs" />
     <Compile Include="Options\OptionsDialog.cs">
       <SubType>Form</SubType>
@@ -96,5 +98,5 @@
     <Compile Include="LabelProvider\StringLabelProvider.cs" />
     <Compile Include="TextShape.cs" />
-    <Compile Include="LegendShape.cs" />
+    <Compile Include="Legend\LegendShape.cs" />
     <Compile Include="DataRow.cs" />
     <Compile Include="DrawingStyle.cs" />
Index: trunk/sources/HeuristicLab.Visualization/HeuristicLabVisualizationPlugin.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/HeuristicLabVisualizationPlugin.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/HeuristicLabVisualizationPlugin.cs	(revision 1233)
@@ -20,7 +20,4 @@
 #endregion
 
-using System;
-using System.Collections.Generic;
-using System.Text;
 using HeuristicLab.PluginInfrastructure;
 
Index: trunk/sources/HeuristicLab.Visualization/HorizontalLineShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/HorizontalLineShape.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/HorizontalLineShape.cs	(revision 1233)
@@ -1,14 +1,12 @@
 ﻿using System.Drawing;
-using System.Drawing.Drawing2D;
 
 namespace HeuristicLab.Visualization {
   public class MinMaxLineShape : WorldShape {
-    private LineShape minLineShape;
-    private LineShape maxLineShape;
+    private readonly LineShape minLineShape;
+    private readonly LineShape maxLineShape;
 
     /// <summary>
     /// Initializes the HorizontalLineShape.
     /// </summary>
-    /// <param name="z">Z-order</param>
     /// <param name="color">color for the LineShape</param>
     /// <param name="yMin">y value for lower line</param>
@@ -16,7 +14,7 @@
     /// <param name="thickness">line thickness</param>
     /// <param name="style">line style</param>
-    public MinMaxLineShape(double yMin, double yMax, double z, Color color, int thickness, DrawingStyle style) {
-      minLineShape = new LineShape(0, yMin, 1, yMin, z, color, thickness, style);
-      maxLineShape = new LineShape(0, yMax, 1, yMax, z, color, thickness, style);
+    public MinMaxLineShape(double yMin, double yMax, Color color, int thickness, DrawingStyle style) {
+      minLineShape = new LineShape(0, yMin, 1, yMin, color, thickness, style);
+      maxLineShape = new LineShape(0, yMax, 1, yMax, color, thickness, style);
       shapes.Add(minLineShape);
       shapes.Add(maxLineShape);
Index: trunk/sources/HeuristicLab.Visualization/IDataRow.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/IDataRow.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/IDataRow.cs	(revision 1233)
@@ -15,4 +15,9 @@
     DataRowType LineType { get; set; }
     ILabelProvider YAxisLabelProvider { get; set; }
+
+    /// <summary>
+    /// Raised when data row data changed. Should cause redraw in the view.
+    /// </summary>
+    event DataRowChangedHandler DataRowChanged;
 
     void AddValue(double value);
Index: trunk/sources/HeuristicLab.Visualization/Legend/LegendItem.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/Legend/LegendItem.cs	(revision 1233)
+++ trunk/sources/HeuristicLab.Visualization/Legend/LegendItem.cs	(revision 1233)
@@ -0,0 +1,15 @@
+using System.Drawing;
+
+namespace HeuristicLab.Visualization.Legend {
+  public class LegendItem {
+    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; }
+  }
+}
Index: trunk/sources/HeuristicLab.Visualization/Legend/LegendShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/Legend/LegendShape.cs	(revision 1233)
+++ trunk/sources/HeuristicLab.Visualization/Legend/LegendShape.cs	(revision 1233)
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using HeuristicLab.Visualization.Legend;
+
+namespace HeuristicLab.Visualization.Legend {
+  public class LegendShape : WorldShape {
+    private readonly IList<LegendItem> legendItems = new List<LegendItem>();
+    
+    public LegendShape() {
+      CreateLegend();
+    }
+
+    public void CreateLegend() {
+      shapes.Clear();
+      double y = ClippingArea.Y2;
+      foreach (LegendItem item in legendItems) {
+        AddShape(new LineShape(10, y - 10, 30, y - 10, item.Color, item.Thickness, DrawingStyle.Solid));
+        AddShape(new TextShape(35, y, item.Label));
+        y -= 15;
+      }
+    }
+
+    public void AddLegendItem(LegendItem item) {
+      legendItems.Add(item);
+    }
+
+    public void RemoveLegendItem(LegendItem item) {
+      legendItems.Remove(item);
+    }
+
+    public void ClearLegendItems() {
+      legendItems.Clear();
+    }
+  }
+}
Index: trunk/sources/HeuristicLab.Visualization/LegendShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LegendShape.cs	(revision 1232)
+++ 	(revision )
@@ -1,47 +1,0 @@
-using System.Collections.Generic;
-using System.Drawing;
-
-namespace HeuristicLab.Visualization {
-  public class LegendItem {
-    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 : WorldShape {
-    private readonly IList<LegendItem> legendItems = new List<LegendItem>();
-    
-    public LegendShape() {
-      CreateLegend();
-    }
-
-    public void CreateLegend() {
-      shapes.Clear();
-      double y = ClippingArea.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;
-      }
-    }
-
-    public void AddLegendItem(LegendItem item) {
-      legendItems.Add(item);
-    }
-
-    public void RemoveLegendItem(LegendItem item) {
-      legendItems.Remove(item);
-    }
-
-    public void ClearLegendItems() {
-      legendItems.Clear();
-    }
-  }
-}
Index: trunk/sources/HeuristicLab.Visualization/LineChart.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/LineChart.cs	(revision 1233)
@@ -2,7 +2,7 @@
 using System.Collections.Generic;
 using System.Drawing;
-using System.Drawing.Drawing2D;
 using System.Windows.Forms;
 using HeuristicLab.Core;
+using HeuristicLab.Visualization.Legend;
 using HeuristicLab.Visualization.Options;
 
@@ -65,5 +65,5 @@
       root.AddShape(titleShape);
 
-      minMaxLineShape = new MinMaxLineShape(this.minDataValue, this.maxDataValue, 0, Color.Yellow, 4, DrawingStyle.Solid);
+      minMaxLineShape = new MinMaxLineShape(this.minDataValue, this.maxDataValue, Color.Yellow, 4, DrawingStyle.Solid);
       root.AddShape(minMaxLineShape);
 
@@ -207,5 +207,5 @@
       }
       for (int i = 1; i < row.Count; i++) {
-        LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], 0, row.Color, row.Thickness, row.Style);
+        LineShape lineShape = new LineShape(i - 1, row[i - 1], i, row[i], row.Color, row.Thickness, row.Style);
         lineShapes.Add(lineShape);
         // TODO each DataRow needs its own WorldShape so Y Axes can be zoomed independently.
@@ -246,5 +246,5 @@
           maxDataRowCount = row.Count;
         }
-        LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], 0, row.Color, row.Thickness,
+        LineShape lineShape = new LineShape(index - 1, row[index - 1], index, row[index], row.Color, row.Thickness,
                                             row.Style);
         lineShapes.Add(lineShape);
@@ -412,18 +412,13 @@
 
     private void optionsToolStripMenuItem_Click(object sender, EventArgs e) {
-      var optionsdlg = new OptionsDialog(this);
-      optionsdlg.Show();
+      OptionsDialog optionsdlg = new OptionsDialog(this);
+      optionsdlg.ShowDialog(this);
     }
 
     public void ApplyChangesToRow(IDataRow row) {
-      foreach (var ls in rowToLineShapes[row]) {
+      foreach (LineShape ls in rowToLineShapes[row]) {
         ls.LSColor = row.Color;
         ls.LSThickness = row.Thickness;
-        if (row.Style == DrawingStyle.Dashed) {
-          ls.LSDashStyle = DashStyle.Dash;
-        }
-        else {
-          ls.LSDashStyle = DashStyle.Solid; //default
-        }
+        ls.LSDrawingStyle = row.Style;
       }
       canvas.Invalidate();
Index: trunk/sources/HeuristicLab.Visualization/LineShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/LineShape.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/LineShape.cs	(revision 1233)
@@ -5,8 +5,10 @@
   public class LineShape : IShape {
     private RectangleD boundingBox;
-    private double z;
+
     private Color color;
     private int thickness;
-    private DashStyle dashStyle;
+    private DrawingStyle drawingStyle;
+
+    private Pen pen;
 
     /// <summary>
@@ -18,15 +20,11 @@
     /// <param name="y2">y coordinate of right lineEndPoind</param>
     /// <param name="color">color for the LineShape</param>
-    public LineShape(double x1, double y1, double x2, double y2, double z, Color color, int thickness, DrawingStyle style) {
+    /// <param name="thickness">tickness of the line in pixels</param>
+    /// <param name="drawingStyle">drawing style of the line (solid, dashed, dotted,...)</param>
+    public LineShape(double x1, double y1, double x2, double y2, Color color, int thickness, DrawingStyle drawingStyle) {
       this.boundingBox = new RectangleD(x1, y1, x2, y2);
-      this.z = z;
       this.LSColor = color;
       this.LSThickness = thickness;
-      if (style==DrawingStyle.Dashed) {
-        this.LSDashStyle = DashStyle.Dash;
-      }
-      else {
-        this.LSDashStyle = DashStyle.Solid;        //default
-      }
+      this.LSDrawingStyle = drawingStyle;
     }
 
@@ -62,29 +60,55 @@
     /// <param name="clippingArea">rectangle in screen-coordinates to draw</param>
     public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
-      using (Pen pen = new Pen(LSColor, LSThickness)){
-        pen.DashStyle = this.LSDashStyle;
-        Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea);
-        graphics.DrawLine(pen,screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
-      }
+      Rectangle screenRect = Transform.ToScreen(boundingBox, viewport, clippingArea);
+
+      graphics.DrawLine(GetPen(), screenRect.Left, screenRect.Bottom, screenRect.Right, screenRect.Top);
     }
 
-    public double Z {
-      get { return z; }
-      set { z = value; }
+    private Pen GetPen() {
+      if (pen == null) {
+        pen = new Pen(LSColor, LSThickness);
+
+        switch (LSDrawingStyle) {
+          case DrawingStyle.Dashed:
+            pen.DashStyle = DashStyle.Dash;
+            break;
+          default:
+            pen.DashStyle = DashStyle.Solid;
+            break;
+        }
+      }
+
+      return pen;
+    }
+
+    private void DisposePen() {
+      if (pen != null) {
+        pen.Dispose();
+        pen = null;
+      }
     }
 
     public Color LSColor {
       get { return color; }
-      set { color = value; }
+      set {
+        color = value;
+        DisposePen();
+      }
     }
 
     public int LSThickness {
       get { return thickness; }
-      set { thickness = value; }
+      set {
+        thickness = value;
+        DisposePen();
+      }
     }
 
-    public DashStyle LSDashStyle {
-      get { return dashStyle; }
-      set { dashStyle = value; }
+    public DrawingStyle LSDrawingStyle {
+      get { return drawingStyle; }
+      set {
+        drawingStyle = value;
+        DisposePen();
+      }
     }
   }
Index: trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/Options/OptionsDialog.cs	(revision 1233)
@@ -1,14 +1,8 @@
 ﻿using System;
 using System.Collections.Generic;
-using System.ComponentModel;
-using System.Data;
-using System.Drawing;
-using System.Linq;
-using System.Text;
 using System.Windows.Forms;
 
 namespace HeuristicLab.Visualization.Options {
   public partial class OptionsDialog : Form {
-
     private LineChart lc;
 
@@ -18,7 +12,6 @@
     }
 
-
     private void button1_Click(object sender, EventArgs e) {
-      var dlg = new ColorDialog();
+      ColorDialog dlg = new ColorDialog();
       dlg.ShowDialog();
       this.ColorPreviewTB.BackColor = dlg.Color;
@@ -44,9 +37,11 @@
 
     private void LineSelectCB_SelectedIndexChanged(object sender, EventArgs e) {
-      int index = this.LineThicknessCB.FindStringExact(((IDataRow) this.LineSelectCB.SelectedValue).Thickness.ToString());
+      IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
+
+      int index = this.LineThicknessCB.FindStringExact(datarow.Thickness.ToString());
       this.LineThicknessCB.SelectedIndex = index;
-      index = this.LinestyleCB.FindStringExact(((IDataRow) this.LineSelectCB.SelectedValue).Style.ToString());
+      index = this.LinestyleCB.FindStringExact(datarow.Style.ToString());
       LinestyleCB.SelectedIndex = index;
-      this.ColorPreviewTB.BackColor = ((IDataRow) this.LineSelectCB.SelectedValue).Color;
+      this.ColorPreviewTB.BackColor = datarow.Color;
     }
 
@@ -56,8 +51,11 @@
 
     private void OptionsDialogOkButton_Click(object sender, EventArgs e) {
-      ((IDataRow) this.LineSelectCB.SelectedValue).Thickness = (int) this.LineThicknessCB.SelectedItem;
-      ((IDataRow) this.LineSelectCB.SelectedValue).Color = this.ColorPreviewTB.BackColor;
-      ((IDataRow) this.LineSelectCB.SelectedValue).Style = (DrawingStyle) this.LineThicknessCB.SelectedItem;
-      this.lc.ApplyChangesToRow((IDataRow) this.LineSelectCB.SelectedValue);
+      IDataRow datarow = (IDataRow)this.LineSelectCB.SelectedValue;
+
+      datarow.Thickness = (int)this.LineThicknessCB.SelectedItem;
+      datarow.Color = this.ColorPreviewTB.BackColor;
+      datarow.Style = (DrawingStyle)this.LineThicknessCB.SelectedItem;
+
+      this.lc.ApplyChangesToRow(datarow);
       this.Close();
     }
Index: trunk/sources/HeuristicLab.Visualization/RectangleShape.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/RectangleShape.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/RectangleShape.cs	(revision 1233)
@@ -4,6 +4,10 @@
   public class RectangleShape : IShape {
     private RectangleD rectangle;
+
     private Color color;
     private int opacity = 255;
+
+    private Pen pen;
+    private Brush brush;
 
     public RectangleShape(double x1, double y1, double x2, double y2, Color color) {
@@ -16,21 +20,4 @@
     }
 
-    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
-      Color brushColor = Color.FromArgb(opacity, color);
-
-      using (Pen pen = new Pen(color, 1))
-      using (Brush brush = new SolidBrush(brushColor)) {
-        Rectangle screenRect = Transform.ToScreen(rectangle, viewport, clippingArea);
-
-        graphics.DrawRectangle(pen, screenRect);
-        graphics.FillRectangle(brush, screenRect);
-      }
-    }
-
-    public int Opacity {
-      get { return opacity; }
-      set { opacity = value; }
-    }
-
     public RectangleD Rectangle {
       get { return rectangle; }
@@ -38,7 +25,49 @@
     }
 
+    public void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
+      Rectangle screenRect = Transform.ToScreen(rectangle, viewport, clippingArea);
+
+      graphics.DrawRectangle(GetPen(), screenRect);
+      graphics.FillRectangle(GetBrush(), screenRect);
+    }
+
+    private Pen GetPen() {
+      if (pen == null)
+        pen = new Pen(color, 1);
+      return pen;
+    }
+
+    private Brush GetBrush() {
+      if (brush == null)
+        brush = new SolidBrush(Color.FromArgb(opacity, color));
+      return brush;
+    }
+
+    public int Opacity {
+      get { return opacity; }
+      set {
+        opacity = value;
+        DisposeDrawingTools();
+      }
+    }
+
     public Color Color {
       get { return color; }
-      set { color = value; }
+      set {
+        color = value;
+        DisposeDrawingTools();
+      }
+    }
+
+    private void DisposeDrawingTools() {
+      if (pen != null) {
+        pen.Dispose();
+        pen = null;
+      }
+
+      if (brush != null) {
+        brush.Dispose();
+        brush = null;
+      }
     }
   }
Index: trunk/sources/HeuristicLab.Visualization/XAxis.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/XAxis.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/XAxis.cs	(revision 1233)
@@ -1,4 +1,2 @@
-using System;
-using System.Collections.Generic;
 using System.Drawing;
 using HeuristicLab.Visualization.LabelProvider;
@@ -7,4 +5,5 @@
   public class XAxis : WorldShape {
     public const int PixelsPerInterval = 100;
+    
     private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####");
 
@@ -14,26 +13,10 @@
     }
 
-    public static IEnumerable<double> GetTicks(int pixelsPerInterval, int screenSize, double worldSize, double worldStart) {
-      int intervals = screenSize/pixelsPerInterval;
-
-      if (intervals > 0) {
-        double step = worldSize/intervals;
-        step = Math.Pow(10, Math.Floor(Math.Log10(step)));
-        if (worldSize/(step*5) > intervals)
-          step = step*5;
-        else if (worldSize/(step*2) > intervals)
-          step = step*2;
-
-        for (double x = Math.Floor(worldStart/step)*step;
-             x <= worldStart + worldSize;
-             x += step)
-          yield return x;
-      }
-    }
-
     public override void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
       shapes.Clear();
 
-      foreach (double x in GetTicks(PixelsPerInterval, viewport.Width, ClippingArea.Width, ClippingArea.X1)) {
+      foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, viewport.Width,
+                                              ClippingArea.Width,
+                                              ClippingArea.X1)) {
         TextShape label = new TextShape(x, ClippingArea.Height - 3,
                                         labelProvider.GetLabel(x));
Index: trunk/sources/HeuristicLab.Visualization/YAxis.cs
===================================================================
--- trunk/sources/HeuristicLab.Visualization/YAxis.cs	(revision 1232)
+++ trunk/sources/HeuristicLab.Visualization/YAxis.cs	(revision 1233)
@@ -16,8 +16,7 @@
       shapes.Clear();
 
-      foreach (double y in XAxis.GetTicks(PixelsPerInterval,
-                                          viewport.Height,
-                                          ClippingArea.Height,
-                                          ClippingArea.Y1)) {
+      foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, viewport.Height,
+                                              ClippingArea.Height,
+                                              ClippingArea.Y1)) {
         TextShape label = new TextShape(ClippingArea.X2 - 3, y,
                                         labelProvider.GetLabel(y));
