Last change
on this file since 1591 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
|
Rev | Line | |
---|
[987] | 1 | using System.Drawing;
|
---|
[1194] | 2 | using HeuristicLab.Visualization.LabelProvider;
|
---|
[987] | 3 |
|
---|
[983] | 4 | namespace 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 |
|
---|
[1337] | 10 | private Color color = Color.Blue;
|
---|
| 11 | private Font font = new Font("Arial", 8);
|
---|
[1462] | 12 | private bool showLabel = true;
|
---|
| 13 | private string label = "";
|
---|
[1337] | 14 |
|
---|
[1182] | 15 | public ILabelProvider LabelProvider {
|
---|
| 16 | get { return labelProvider; }
|
---|
| 17 | set { labelProvider = value; }
|
---|
[1038] | 18 | }
|
---|
[987] | 19 |
|
---|
[1240] | 20 | public override void Draw(Graphics graphics) {
|
---|
| 21 | ClearShapes();
|
---|
[987] | 22 |
|
---|
[1240] | 23 | foreach (double x in AxisTicks.GetTicks(PixelsPerInterval, Parent.Viewport.Width,
|
---|
[1233] | 24 | ClippingArea.Width,
|
---|
| 25 | ClippingArea.X1)) {
|
---|
[1462] | 26 | TextShape tickLabel = new TextShape(x, ClippingArea.Height - 3,
|
---|
[1337] | 27 | labelProvider.GetLabel(x), Font, Color);
|
---|
[1462] | 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);
|
---|
[1182] | 37 | label.AnchorPositionX = AnchorPositionX.Middle;
|
---|
[1462] | 38 | label.AnchorPositionY = AnchorPositionY.Bottom;
|
---|
| 39 |
|
---|
[1240] | 40 | AddShape(label);
|
---|
[987] | 41 | }
|
---|
[1038] | 42 |
|
---|
[1240] | 43 | base.Draw(graphics);
|
---|
[987] | 44 | }
|
---|
[1337] | 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 | }
|
---|
[1462] | 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 | }
|
---|
[983] | 65 | }
|
---|
| 66 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.