Free cookie consent management tool by TermsFeed Policy Generator

Ignore:
Timestamp:
03/27/09 17:34:56 (15 years ago)
Author:
mstoeger
Message:

Implement Y-Axis Position (left/right) (#554)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization/YAxis.cs

    r1343 r1457  
     1using System;
    12using System.Drawing;
    23using HeuristicLab.Visualization.LabelProvider;
     4using HeuristicLab.Visualization.Test;
    35
    46namespace HeuristicLab.Visualization {
     
    79
    810    private ILabelProvider labelProvider = new ContinuousLabelProvider("e4");
     11    private AxisPosition position = AxisPosition.Left;
    912
    1013    public ILabelProvider LabelProvider {
    1114      get { return labelProvider; }
    1215      set { labelProvider = value; }
     16    }
     17
     18    public AxisPosition Position {
     19      get { return position; }
     20      set { position = value; }
    1321    }
    1422
     
    1927                                              ClippingArea.Height,
    2028                                              ClippingArea.Y1)) {
    21         TextShape label = new TextShape(ClippingArea.X2 - 3, y,
    22                                         labelProvider.GetLabel(y));
    23         label.AnchorPositionX = AnchorPositionX.Right;
     29        double x;
     30        AnchorPositionX anchorPositionX;
     31
     32        switch (position) {
     33          case AxisPosition.Left:
     34            x = ClippingArea.X2 - 3;
     35            anchorPositionX = AnchorPositionX.Right;
     36            break;
     37          case AxisPosition.Right:
     38            x = ClippingArea.X1 + 3;
     39            anchorPositionX = AnchorPositionX.Left;
     40            break;
     41          default:
     42            throw new NotImplementedException();
     43        }
     44       
     45        TextShape label = new TextShape(x, y, labelProvider.GetLabel(y));
     46        label.AnchorPositionX = anchorPositionX;
    2447        label.AnchorPositionY = AnchorPositionY.Middle;
    2548        AddShape(label);
Note: See TracChangeset for help on using the changeset viewer.