org.jfree.chart.axis
Class DateTickUnit
- Comparable, Serializable
A tick unit for use by subclasses of
DateAxis
. Instances of this
class are immutable.
static int | DAY - A constant for days.
|
static int | HOUR - A constant for hours.
|
static int | MILLISECOND - A constant for milliseconds.
|
static int | MINUTE - A constant for minutes.
|
static int | MONTH - A constant for months.
|
static int | SECOND - A constant for seconds.
|
static int | YEAR - A constant for years.
|
DateTickUnit(int unit, int count) - Creates a new date tick unit.
|
DateTickUnit(int unit, int count, DateFormat formatter) - Creates a new date tick unit.
|
DateTickUnit(int unit, int count, int rollUnit, int rollCount, DateFormat formatter) - Creates a new unit.
|
Date | addToDate(Date base) - As of JFreeChart 1.0.10, this method is deprecated - you
should use
addToDate(Date,TimeZone) instead.
|
Date | addToDate(Date base, TimeZone zone) - Calculates a new date by adding this unit to the base date.
|
String | dateToString(Date date) - Formats a date using the tick unit's formatter.
|
boolean | equals(Object obj) - Tests this unit for equality with another object.
|
int | getCalendarField() - Returns a field code that can be used with the
Calendar
class.
|
int | getCount() - Returns the unit count.
|
int | getRollCount() - Returns the roll count.
|
int | getRollUnit() - Returns the roll unit.
|
int | getUnit() - Returns the date unit.
|
int | hashCode() - Returns a hash code for this object.
|
Date | rollDate(Date base) - Rolls the date forward by the amount specified by the roll unit and
count.
|
Date | rollDate(Date base, TimeZone zone) - Rolls the date forward by the amount specified by the roll unit and
count.
|
String | toString() - Returns a string representation of this instance, primarily used for
debugging purposes.
|
String | valueToString(double milliseconds) - Formats a value.
|
DAY
public static final int DAY
A constant for days.
HOUR
public static final int HOUR
A constant for hours.
MILLISECOND
public static final int MILLISECOND
A constant for milliseconds.
MINUTE
public static final int MINUTE
A constant for minutes.
MONTH
public static final int MONTH
A constant for months.
SECOND
public static final int SECOND
A constant for seconds.
YEAR
public static final int YEAR
A constant for years.
DateTickUnit
public DateTickUnit(int unit,
int count)
Creates a new date tick unit. The dates will be formatted using a
SHORT format for the default locale.
unit
- the unit.count
- the unit count.
DateTickUnit
public DateTickUnit(int unit,
int count,
DateFormat formatter)
Creates a new date tick unit. You can specify the units using one of
the constants YEAR, MONTH, DAY, HOUR, MINUTE, SECOND or MILLISECOND.
In addition, you can specify a unit count, and a date format.
unit
- the unit.count
- the unit count.formatter
- the date formatter (defaults to DateFormat.SHORT).
DateTickUnit
public DateTickUnit(int unit,
int count,
int rollUnit,
int rollCount,
DateFormat formatter)
Creates a new unit.
unit
- the unit.count
- the count.rollUnit
- the roll unit.rollCount
- the roll count.formatter
- the date formatter (defaults to DateFormat.SHORT).
addToDate
public Date addToDate(Date base)
As of JFreeChart 1.0.10, this method is deprecated - you
should use addToDate(Date,TimeZone)
instead.
Calculates a new date by adding this unit to the base date, with
calculations performed in the default timezone and locale.
- A new date one unit after the base date.
addToDate
public Date addToDate(Date base,
TimeZone zone)
Calculates a new date by adding this unit to the base date.
base
- the base date.zone
- the time zone for the date calculation.
- A new date one unit after the base date.
dateToString
public String dateToString(Date date)
Formats a date using the tick unit's formatter.
equals
public boolean equals(Object obj)
Tests this unit for equality with another object.
- equals in interface TickUnit
obj
- the object (null
permitted).
getCalendarField
public int getCalendarField()
Returns a field code that can be used with the Calendar
class.
getCount
public int getCount()
Returns the unit count.
getRollCount
public int getRollCount()
Returns the roll count.
getRollUnit
public int getRollUnit()
Returns the roll unit. This is the amount by which the tick advances if
it is "hidden" when displayed on a segmented date axis. Typically the
roll will be smaller than the regular tick unit (for example, a 7 day
tick unit might use a 1 day roll).
getUnit
public int getUnit()
Returns the date unit. This will be one of the constants
YEAR
, MONTH
, DAY
,
HOUR
, MINUTE
, SECOND
or
MILLISECOND
, defined by this class. Note that these
constants do NOT correspond to those defined in Java's
Calendar
class.
rollDate
public Date rollDate(Date base)
Rolls the date forward by the amount specified by the roll unit and
count.
rollDate
public Date rollDate(Date base,
TimeZone zone)
Rolls the date forward by the amount specified by the roll unit and
count.
base
- the base date.zone
- the time zone.
toString
public String toString()
Returns a string representation of this instance, primarily used for
debugging purposes.
- A string representation of this instance.