Last change
on this file since 1307 was
1285,
checked in by mstoeger, 16 years ago
|
Implemented multiple Y-Axes. (#433) Panning & Zooming is broken.
|
File size:
1.2 KB
|
Rev | Line | |
---|
[1182] | 1 | using System.Drawing;
|
---|
[1194] | 2 | using HeuristicLab.Visualization.LabelProvider;
|
---|
[1182] | 3 |
|
---|
| 4 | namespace HeuristicLab.Visualization {
|
---|
| 5 | public class YAxis : WorldShape {
|
---|
| 6 | public const int PixelsPerInterval = 75;
|
---|
| 7 |
|
---|
[1194] | 8 | private ILabelProvider labelProvider = new ContinuousLabelProvider("e4");
|
---|
[1285] | 9 | private bool visible = true;
|
---|
[1182] | 10 |
|
---|
| 11 | public ILabelProvider LabelProvider {
|
---|
| 12 | get { return labelProvider; }
|
---|
| 13 | set { labelProvider = value; }
|
---|
| 14 | }
|
---|
| 15 |
|
---|
[1285] | 16 | public bool Visible {
|
---|
| 17 | get { return visible; }
|
---|
| 18 | set { visible = value; }
|
---|
| 19 | }
|
---|
| 20 |
|
---|
[1240] | 21 | public override void Draw(Graphics graphics) {
|
---|
| 22 | ClearShapes();
|
---|
[1182] | 23 |
|
---|
[1285] | 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 | }
|
---|
[1182] | 34 | }
|
---|
| 35 |
|
---|
[1240] | 36 | base.Draw(graphics);
|
---|
[1182] | 37 | }
|
---|
| 38 | }
|
---|
| 39 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.