Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 1346 was 1337, checked in by bspisic, 15 years ago

#520 Implemented font changes of x-axis, legend and title

File size: 1.3 KB
Line 
1using System.Drawing;
2using HeuristicLab.Visualization.LabelProvider;
3
4namespace HeuristicLab.Visualization {
5  public class XAxis : WorldShape {
6    public const int PixelsPerInterval = 100;
7   
8    private ILabelProvider labelProvider = new ContinuousLabelProvider("0.####");
9
10    private Color color = Color.Blue;
11    private Font font = new Font("Arial", 8);
12
13    public ILabelProvider LabelProvider {
14      get { return labelProvider; }
15      set { labelProvider = value; }
16    }
17
18    public override void Draw(Graphics graphics) {
19      ClearShapes();
20
21      foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Width,
22                                              ClippingArea.Width,
23                                              ClippingArea.X1)) {
24        TextShape label = new TextShape(x, ClippingArea.Height - 3,
25                                        labelProvider.GetLabel(x), Font, Color);
26        label.AnchorPositionX = AnchorPositionX.Middle;
27        label.AnchorPositionY = AnchorPositionY.Top;
28        AddShape(label);
29      }
30
31      base.Draw(graphics);
32    }
33
34    public Color Color {
35      get { return color; }
36      set { color = value; }
37    }
38
39    public Font Font {
40      get { return font; }
41      set { font = value; }
42    }
43  }
44}
Note: See TracBrowser for help on using the repository browser.