Last change
on this file since 6004 was
1530,
checked in by gkronber, 16 years ago
|
Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576
|
File size:
1.9 KB
|
Line | |
---|
1 | using System.Drawing;
|
---|
2 | using HeuristicLab.Visualization.LabelProvider;
|
---|
3 |
|
---|
4 | namespace 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 | private bool showLabel = true;
|
---|
13 | private string label = "";
|
---|
14 |
|
---|
15 | public ILabelProvider LabelProvider {
|
---|
16 | get { return labelProvider; }
|
---|
17 | set { labelProvider = value; }
|
---|
18 | }
|
---|
19 |
|
---|
20 | public override void Draw(Graphics graphics) {
|
---|
21 | ClearShapes();
|
---|
22 |
|
---|
23 | foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Width,
|
---|
24 | ClippingArea.Width,
|
---|
25 | ClippingArea.X1)) {
|
---|
26 | TextShape tickLabel = new TextShape(x, ClippingArea.Height - 3,
|
---|
27 | labelProvider.GetLabel(x), Font, Color);
|
---|
28 | tickLabel.AnchorPositionX = AnchorPositionX.Middle;
|
---|
29 | tickLabel.AnchorPositionY = AnchorPositionY.Top;
|
---|
30 | AddShape(tickLabel);
|
---|
31 | }
|
---|
32 |
|
---|
33 | if (showLabel) {
|
---|
34 | TextShape label = new TextShape(ClippingArea.X1 + ClippingArea.Width/2,
|
---|
35 | ClippingArea.Y1 + 3,
|
---|
36 | this.label);
|
---|
37 | label.AnchorPositionX = AnchorPositionX.Middle;
|
---|
38 | label.AnchorPositionY = AnchorPositionY.Bottom;
|
---|
39 |
|
---|
40 | AddShape(label);
|
---|
41 | }
|
---|
42 |
|
---|
43 | base.Draw(graphics);
|
---|
44 | }
|
---|
45 |
|
---|
46 | public Color Color {
|
---|
47 | get { return color; }
|
---|
48 | set { color = value; }
|
---|
49 | }
|
---|
50 |
|
---|
51 | public Font Font {
|
---|
52 | get { return font; }
|
---|
53 | set { font = value; }
|
---|
54 | }
|
---|
55 |
|
---|
56 | public bool ShowLabel {
|
---|
57 | get { return showLabel; }
|
---|
58 | set { showLabel = value; }
|
---|
59 | }
|
---|
60 |
|
---|
61 | public string Label {
|
---|
62 | get { return label; }
|
---|
63 | set { label = value; }
|
---|
64 | }
|
---|
65 | }
|
---|
66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.