Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/XAxis.cs @ 1248

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

Transformations on shapes are possible outside of the Draw method. (#424)

File size: 1.0 KB
RevLine 
[987]1using System.Drawing;
[1194]2using HeuristicLab.Visualization.LabelProvider;
[987]3
[983]4namespace HeuristicLab.Visualization {
[1038]5  public class XAxis : WorldShape {
[1182]6    public const int PixelsPerInterval = 100;
[1233]7   
[1194]8    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####");
[983]9
[1182]10    public ILabelProvider LabelProvider {
11      get { return labelProvider; }
12      set { labelProvider = value; }
[1038]13    }
[987]14
[1240]15    public override void Draw(Graphics graphics) {
16      ClearShapes();
[987]17
[1240]18      foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Width,
[1233]19                                              ClippingArea.Width,
20                                              ClippingArea.X1)) {
[1182]21        TextShape label = new TextShape(x, ClippingArea.Height - 3,
22                                        labelProvider.GetLabel(x));
23        label.AnchorPositionX = AnchorPositionX.Middle;
24        label.AnchorPositionY = AnchorPositionY.Top;
[1240]25        AddShape(label);
[987]26      }
[1038]27
[1240]28      base.Draw(graphics);
[987]29    }
[983]30  }
31}
Note: See TracBrowser for help on using the repository browser.