jas2.plot
Class TimeAxis
- java.lang.Object
-
- jas2.plot.AxisType
-
- jas2.plot.TimeAxis
-
- All Implemented Interfaces:
- CoordinateTransformation, TimeCoordinateTransformation, java.io.Externalizable, java.io.Serializable
public final class TimeAxis extends AxisType implements TimeCoordinateTransformation
An axis type for representing times.Note that this is not the same as dates. A date represents a particular point in time (e.g., when an event took place). This axis represents time values, such as the time between two events. Therefore, while a date value may be represented as "Jan 31, 1994", a time value might be represented as "3 weeks".
- See Also:
DateAxis, Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static intDAYSThe integer code for day units.static intHOURSThe integer code for hour units.static intMILLISECONDSThe integer code for millisecond units.static intMINUTESThe integer code for minute units.static intMONTHSThe integer code for month units.static longOMITSetOMITas the length of a time unit to have that unit not considered as a candidate for axis units.static intSECONDSThe integer code for second units.static intWEEKSThe integer code for week units.static intYEARSThe integer code for year units.
-
Constructor Summary
Constructors Constructor and Description TimeAxis()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description doubleconvert(long time)Returns a pixel value for a time value.longgetAxisMax()Returns the maximum value on the axis range.longgetAxisMin()Returns the minimum value on the axis range.longgetDataMax()Returns the maximum value on the axis range, as set by the methodsetMax(long).longgetDataMin()Returns the minimum value on the data range, as set by the methodsetMin(long).longgetUnitLength(int unit)Returns the number of milliseconds for this unit, orOMIT.java.lang.StringgetUnits()Returns a string representation of the units showing on the axis.voidreadExternal(java.io.ObjectInput in)voidsetMax(long max)Sets the maximum value for the axis data.voidsetMin(long min)Sets the minimum value for the axis data.voidsetUnitLength(int unit, long length)Allows units to be viewed as valued different from the default.voidsetUseSuggestedRange(boolean useSuggestedRange)Sets whether this object should round the minimum down and the maximum up to make labels land exactly on the min and max of the axis range.voidwriteExternal(java.io.ObjectOutput out)
-
-
-
Field Detail
-
MILLISECONDS
public static final int MILLISECONDS
The integer code for millisecond units.- See Also:
- Constant Field Values
-
SECONDS
public static final int SECONDS
The integer code for second units.- See Also:
- Constant Field Values
-
MINUTES
public static final int MINUTES
The integer code for minute units.- See Also:
- Constant Field Values
-
HOURS
public static final int HOURS
The integer code for hour units.- See Also:
- Constant Field Values
-
DAYS
public static final int DAYS
The integer code for day units.- See Also:
- Constant Field Values
-
WEEKS
public static final int WEEKS
The integer code for week units.- See Also:
- Constant Field Values
-
MONTHS
public static final int MONTHS
The integer code for month units.- See Also:
- Constant Field Values
-
YEARS
public static final int YEARS
The integer code for year units.- See Also:
- Constant Field Values
-
OMIT
public static final long OMIT
SetOMITas the length of a time unit to have that unit not considered as a candidate for axis units.- See Also:
- Constant Field Values
-
-
Method Detail
-
setUnitLength
public void setUnitLength(int unit, long length)Allows units to be viewed as valued different from the default. For example, a year by default is1000L * 60L * 60L * 24L * 365Lmilliseconds, but a call such as this may be desirable:
setUnitLength(TimeAxis.YEARS, (long) (1000 * 60 * 60 * 24 * 365.24));
-
getUnitLength
public long getUnitLength(int unit)
Returns the number of milliseconds for this unit, orOMIT.- See Also:
OMIT
-
getUnits
public java.lang.String getUnits()
Returns a string representation of the units showing on the axis.
-
setUseSuggestedRange
public void setUseSuggestedRange(boolean useSuggestedRange)
Sets whether this object should round the minimum down and the maximum up to make labels land exactly on the min and max of the axis range.
-
setMin
public void setMin(long min)
Sets the minimum value for the axis data.
-
setMax
public void setMax(long max)
Sets the maximum value for the axis data.
-
getAxisMin
public long getAxisMin()
Returns the minimum value on the axis range. This value may be smaller than the data minimum if the axis has been told to use the suggested range.- See Also:
setUseSuggestedRange(boolean),setMin(long),getDataMin()
-
getAxisMax
public long getAxisMax()
Returns the maximum value on the axis range. This value may be larger than the data maximum if the axis has been told to use the suggested range.- See Also:
setUseSuggestedRange(boolean),setMax(long),getDataMax()
-
getDataMin
public long getDataMin()
Returns the minimum value on the data range, as set by the methodsetMin(long). This value may be larger than the axis minimum if the axis has been told to use the suggested range.- See Also:
setMin(long),setUseSuggestedRange(boolean),getAxisMin()
-
getDataMax
public long getDataMax()
Returns the maximum value on the axis range, as set by the methodsetMax(long). This value may be smaller than the axis maximum if the axis has been told to use the suggested range.- See Also:
setMax(long),setUseSuggestedRange(boolean),getAxisMax()
-
convert
public double convert(long time)
Description copied from interface:TimeCoordinateTransformationReturns a pixel value for a time value.- Specified by:
convertin interfaceTimeCoordinateTransformation
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOException- Specified by:
writeExternalin interfacejava.io.Externalizable- Throws:
java.io.IOException
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundException- Specified by:
readExternalin interfacejava.io.Externalizable- Throws:
java.io.IOExceptionjava.lang.ClassNotFoundException
-
-
DataMelt 3.0 © DataMelt by jWork.ORG