Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 1233 was 1233, checked in by mstoeger, 15 years ago

General housekeeping (#498) Removed some old unused Z-Order values. Replaced some var types by concrete types. Renamed some LineShape properties. Added caching of Pens and Brushes in LineShape and RectangleShape. Put axis tick calculation algorithm into its own class.

File size: 1.1 KB
Line 
1using System.Drawing;
2using HeuristicLab.Visualization.LabelProvider;
3
4namespace HeuristicLab.Visualization {
5  public class YAxis : WorldShape {
6    public const int PixelsPerInterval = 75;
7
8    private ILabelProvider labelProvider = new ContinuousLabelProvider("e4");
9
10    public ILabelProvider LabelProvider {
11      get { return labelProvider; }
12      set { labelProvider = value; }
13    }
14
15    public override void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
16      shapes.Clear();
17
18      foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, 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.