Last change
on this file since 1222 was
1194,
checked in by mstoeger, 15 years ago
|
Implemented a continuous-, discrete- and string- label provider for the X/Y axis labels. (#433)
|
File size:
1.1 KB
|
Line | |
---|
1 | using System.Drawing;
|
---|
2 | using HeuristicLab.Visualization.LabelProvider;
|
---|
3 |
|
---|
4 | namespace HeuristicLab.Visualization {
|
---|
5 | public class YAxis : WorldShape {
|
---|
6 | public const int PixelsPerInterval = 75;
|
---|
7 |
|
---|
8 | private ILabelProvider labelProvider = new ContinuousLabelProvider("e4");
|
---|
9 |
|
---|
10 | public ILabelProvider LabelProvider {
|
---|
11 | get { return labelProvider; }
|
---|
12 | set { labelProvider = value; }
|
---|
13 | }
|
---|
14 |
|
---|
15 | public override void Draw(Graphics graphics, Rectangle viewport, RectangleD clippingArea) {
|
---|
16 | shapes.Clear();
|
---|
17 |
|
---|
18 | foreach (double y in XAxis.GetTicks(PixelsPerInterval,
|
---|
19 | viewport.Height,
|
---|
20 | ClippingArea.Height,
|
---|
21 | ClippingArea.Y1)) {
|
---|
22 | TextShape label = new TextShape(ClippingArea.X2 - 3, y,
|
---|
23 | labelProvider.GetLabel(y));
|
---|
24 | label.AnchorPositionX = AnchorPositionX.Right;
|
---|
25 | label.AnchorPositionY = AnchorPositionY.Middle;
|
---|
26 | shapes.Add(label);
|
---|
27 | }
|
---|
28 |
|
---|
29 | base.Draw(graphics, viewport, clippingArea);
|
---|
30 | }
|
---|
31 | }
|
---|
32 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.