com.jrefinery.chart
Class TickUnit
java.lang.Object
|
+--com.jrefinery.chart.TickUnit
- All Implemented Interfaces:
- java.lang.Comparable
- Direct Known Subclasses:
- DateTickUnit, NumberTickUnit
- public abstract class TickUnit
- extends java.lang.Object
- implements java.lang.Comparable
Base class representing a tick unit. This determines the spacing of the
tick marks on an axis.
This class (and any subclasses) should be immutable, the reason being that
ORDERED collections of tick units are maintained and if one instance can be
changed, it may destroy the order of the collection that it belongs to.
In addition, if the implementations are immutable, they can belong to
multiple collections.
- Author:
- DG
- See Also:
ValueAxis
Constructor Summary |
TickUnit(double size)
Constructs a new tick unit. |
Method Summary |
int |
compareTo(java.lang.Object object)
Compares this tick unit to an arbitrary object. |
double |
getSize()
Returns the size of the tick unit. |
java.lang.String |
valueToString(double value)
Converts the supplied value to a string. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
TickUnit
public TickUnit(double size)
- Constructs a new tick unit.
- Parameters:
size
- the tick unit size.
getSize
public double getSize()
- Returns the size of the tick unit.
- Returns:
- the size of the tick unit.
valueToString
public java.lang.String valueToString(double value)
- Converts the supplied value to a string.
Subclasses of TickUnit may implement special formatting by overriding this method.
- Parameters:
value
- the data value.- Returns:
- value as string.
compareTo
public int compareTo(java.lang.Object object)
- Compares this tick unit to an arbitrary object.
- Specified by:
compareTo
in interface java.lang.Comparable
- Parameters:
object
- the object to compare against.- Returns:
1
if the size of the other object is less than this,
0
if both have the same size and -1
this
size is less than the others.