Free cookie consent management tool by TermsFeed Policy Generator

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

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

Implemented multiple Y-Axes. (#433) Panning & Zooming is broken.

File size: 1.2 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    private bool visible = true;
10
11    public ILabelProvider LabelProvider {
12      get { return labelProvider; }
13      set { labelProvider = value; }
14    }
15
16    public bool Visible {
17      get { return visible; }
18      set { visible = value; }
19    }
20
21    public override void Draw(Graphics graphics) {
22      ClearShapes();
23
24      if (Visible) {
25        foreach (double y in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Height,
26                                                ClippingArea.Height,
27                                                ClippingArea.Y1)) {
28          TextShape label = new TextShape(ClippingArea.X2 - 3, y,
29                                          labelProvider.GetLabel(y));
30          label.AnchorPositionX = AnchorPositionX.Right;
31          label.AnchorPositionY = AnchorPositionY.Middle;
32          AddShape(label);
33        }
34      }
35
36      base.Draw(graphics);
37    }
38  }
39}
Note: See TracBrowser for help on using the repository browser.