Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/YAxis.cs @ 1182

Last change on this file since 1182 was 1182, checked in by mstoeger, 16 years ago

Implemented X/Y-Axes and a Grid. (#433)

File size: 1.1 KB
Line 
1using System.Drawing;
2
3namespace HeuristicLab.Visualization {
4  public class YAxis : WorldShape {
5    public const int PixelsPerInterval = 75;
6
7    private ILabelProvider labelProvider = new DefaultLabelProvider("e");
8
9    public ILabelProvider LabelProvider {
10      get { return labelProvider; }
11      set { labelProvider = value; }
12    }
13
14    public override void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
15      shapes.Clear();
16
17      foreach (double y in XAxis.GetTicks(PixelsPerInterval,
18                                          viewport.Height,
19                                          ClippingArea.Height,
20                                          ClippingArea.Y1)) {
21        TextShape label = new TextShape(ClippingArea.X2 - 3, y,
22                                        labelProvider.GetLabel(y));
23        label.AnchorPositionX = AnchorPositionX.Right;
24        label.AnchorPositionY = AnchorPositionY.Middle;
25        shapes.Add(label);
26      }
27
28      base.Draw(graphics, viewport, clippingArea);
29    }
30  }
31}
Note: See TracBrowser for help on using the repository browser.