com.approximatrix.charting
Class Axis

java.lang.Object
  extended by com.approximatrix.charting.Axis

public class Axis
extends java.lang.Object

The ClassicCoordSystem contains two or possibly three Axis objects for the x-axis and the at most two y-axis.

Version:
1.0
Author:
mueller armstrong

Field Summary
private  int align
          The axis' alignment.
(package private)  ChartDataModelConstraints constraints
           
static int HORIZONTAL
          Defines a horizontal x-axis.
(package private)  int length
           
static int LINEAR
          Defines a linear scale.
static int LOGARITHMIC
          Defines a logarithmic scale.
static int VERTICAL
          Defines a vertical y-axis.
 
Constructor Summary
Axis(int align, ChartDataModelConstraints c)
          Creates new Axis.
 
Method Summary
 int getAlignment()
          Returns the alignment of the axis.
 int getLength()
          Returns length of the axis in pixels.
 double getPixelForValue(double value)
          Returns the point on the axis for a specific value.
 double getPointToPixelRatio()
          Returns the ratio between a value unit and the screen pixels.
 void setLength(int length)
          Sets the Pixel length of the axis.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HORIZONTAL

public static final int HORIZONTAL
Defines a horizontal x-axis.

See Also:
Constant Field Values

VERTICAL

public static final int VERTICAL
Defines a vertical y-axis.

See Also:
Constant Field Values

LOGARITHMIC

public static final int LOGARITHMIC
Defines a logarithmic scale.

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
Defines a linear scale.

See Also:
Constant Field Values

align

private int align
The axis' alignment.


constraints

ChartDataModelConstraints constraints

length

int length
Constructor Detail

Axis

public Axis(int align,
            ChartDataModelConstraints c)
Creates new Axis.

Parameters:
align - the alignment of the axis.
c - the ChartDataModelConstraints
Method Detail

getAlignment

public int getAlignment()
Returns the alignment of the axis.

Returns:
the alignment constant: Axis.VERTICAL or Axis.HORIZONTAL

setLength

public void setLength(int length)
Sets the Pixel length of the axis.

Parameters:
length - the length in pixel

getLength

public int getLength()
Returns length of the axis in pixels.

Returns:
the length in pixels

getPixelForValue

public double getPixelForValue(double value)
Returns the point on the axis for a specific value. If the axis is a x-axis and the column values are not numeric, this isn't needed since then the axis can be divided into equally long parts. This is a relative pixel distance to the starting pixel of the axis.

Parameters:
value - the double value to compute the pixel distance for
Returns:
the pixel distance for the given value relative to the start of the axis

getPointToPixelRatio

public double getPointToPixelRatio()
Returns the ratio between a value unit and the screen pixels. This is only useful for linear scales.

Returns:
the ratio points / pixel length for the axis.