com.odesys.chart
Class AxisPositioner

java.lang.Object
  |
  +--com.odesys.chart.AxisPositioner

public class AxisPositioner
extends java.lang.Object

AxisPositioner helps position the axis in a way that as many as possible of the constraints are satisfied. The constrraints are used to make sure that all labels are visible.


Constructor Summary
AxisPositioner(int min, int max)
          Creates a new AxisPositioner with the specified min and max axis length
 
Method Summary
 void addConstraint(float pos, int value, float weight)
          Adds a new AxisConstraint to this Axis.
 int getLength()
          Gets the length of the axis.
 int getOffset()
          Gets the offset of the axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AxisPositioner

public AxisPositioner(int min,
                      int max)
Creates a new AxisPositioner with the specified min and max axis length
Method Detail

addConstraint

public void addConstraint(float pos,
                          int value,
                          float weight)
Adds a new AxisConstraint to this Axis. All constraints must be added before the AxisPositioner is resolved by calling getLength() or getOffset(). Each AxisConstraint has position, value and weight. The position determines the point on the Axis where the AxisConstraint is attached. The value is the distance required by the AxisConstraint. The weight determines the power of this AxisConstraint. If all AxisConstraint cannot be satisfied the ones with higher weight are considered more important and are preferred against the ones with less weight.
Parameters:
pos - The position of the new AxisConstraint
value - The value of the new AxisConstraint. The negative values add distance to the left, the positive values add distance to the right.
weight - The weight of the new new AxisConstraint

getLength

public int getLength()
Gets the length of the axis. No more constraints can be added after this method is called.

getOffset

public int getOffset()
Gets the offset of the axis. No more constraints can be added after this method is called.