public class

DateTickUnit

extends TickUnit
implements Serializable
java.lang.Object
   ↳ org.jfree.chart.axis.TickUnit
     ↳ org.jfree.chart.axis.DateTickUnit

Class Overview

A tick unit for use by subclasses of DateAxis. Instances of this class are immutable.

Summary

Constants
int DAY This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int HOUR This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int MILLISECOND This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int MINUTE This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int MONTH This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int SECOND This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
int YEAR This constant is deprecated. As of version 1.0.13, use DateTickUnitType instead.
Public Constructors
DateTickUnit(DateTickUnitType unitType, int multiple)
Creates a new date tick unit.
DateTickUnit(DateTickUnitType unitType, int multiple, DateFormat formatter)
Creates a new date tick unit.
DateTickUnit(DateTickUnitType unitType, int multiple, DateTickUnitType rollUnitType, int rollMultiple, DateFormat formatter)
Creates a new unit.
DateTickUnit(int unit, int count, DateFormat formatter)
This constructor is deprecated. As of version 1.0.13, use DateTickUnit(DateTickUnitType, int, DateFormat).
DateTickUnit(int unit, int count)
This constructor is deprecated. As of version 1.0.13, use DateTickUnit(DateTickUnitType, int).
DateTickUnit(int unit, int count, int rollUnit, int rollCount, DateFormat formatter)
This constructor is deprecated. As of version 1.0.13, use DateTickUnit(DateTickUnitType, int, DateTickUnitType, int, DateFormat).
Public Methods
Date addToDate(Date base)
This method is deprecated. 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()
This method is deprecated. As of version 1.0.13, use getMultiple().
int getMultiple()
Returns the unit multiple.
int getRollCount()
This method is deprecated. As of version 1.0.13, use the getRollMultiple()
int getRollMultiple()
Returns the roll unit multiple.
int getRollUnit()
This method is deprecated. As of version 1.0.13, use getRollUnitType().
DateTickUnitType getRollUnitType()
Returns the roll unit type.
int getUnit()
This method is deprecated. As of 1.0.13, use the getUnitType() method.
DateTickUnitType getUnitType()
Returns the unit type.
int hashCode()
Returns a hash code for this object.
Date rollDate(Date base, TimeZone zone)
Rolls the date forward by the amount specified by the roll unit and count.
Date rollDate(Date base)
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.
[Expand]
Inherited Methods
From class org.jfree.chart.axis.TickUnit
From class java.lang.Object
From interface java.lang.Comparable

Constants

public static final int DAY

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for days.

Constant Value: 2 (0x00000002)

public static final int HOUR

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for hours.

Constant Value: 3 (0x00000003)

public static final int MILLISECOND

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for milliseconds.

Constant Value: 6 (0x00000006)

public static final int MINUTE

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for minutes.

Constant Value: 4 (0x00000004)

public static final int MONTH

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for months.

Constant Value: 1 (0x00000001)

public static final int SECOND

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for seconds.

Constant Value: 5 (0x00000005)

public static final int YEAR

This constant is deprecated.
As of version 1.0.13, use DateTickUnitType instead.

A constant for years.

Constant Value: 0 (0x00000000)

Public Constructors

public DateTickUnit (DateTickUnitType unitType, int multiple)

Creates a new date tick unit.

Parameters
unitType the unit type (null not permitted).
multiple the multiple (of the unit type, must be > 0).

public DateTickUnit (DateTickUnitType unitType, int multiple, DateFormat formatter)

Creates a new date tick unit.

Parameters
unitType the unit type (null not permitted).
multiple the multiple (of the unit type, must be > 0).
formatter the date formatter (null not permitted).

public DateTickUnit (DateTickUnitType unitType, int multiple, DateTickUnitType rollUnitType, int rollMultiple, DateFormat formatter)

Creates a new unit.

Parameters
unitType the unit.
multiple the multiple.
rollUnitType the roll unit.
rollMultiple the roll multiple.
formatter the date formatter (null not permitted).

public DateTickUnit (int unit, int count, DateFormat formatter)

This constructor is deprecated.
As of version 1.0.13, use DateTickUnit(DateTickUnitType, int, DateFormat).

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.

Parameters
unit the unit.
count the unit count.
formatter the date formatter (defaults to DateFormat.SHORT).

public DateTickUnit (int unit, int count)

This constructor is deprecated.
As of version 1.0.13, use DateTickUnit(DateTickUnitType, int).

Creates a new date tick unit. The dates will be formatted using a SHORT format for the default locale.

Parameters
unit the unit.
count the unit count.

public DateTickUnit (int unit, int count, int rollUnit, int rollCount, DateFormat formatter)

This constructor is deprecated.
As of version 1.0.13, use DateTickUnit(DateTickUnitType, int, DateTickUnitType, int, DateFormat).

Creates a new unit.

Parameters
unit the unit.
count the count.
rollUnit the roll unit.
rollCount the roll count.
formatter the date formatter (defaults to DateFormat.SHORT).

Public Methods

public Date addToDate (Date base)

This method is deprecated.
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.

Parameters
base the base date.
Returns
  • A new date one unit after the base date.

public Date addToDate (Date base, TimeZone zone)

Calculates a new date by adding this unit to the base date.

Parameters
base the base date.
zone the time zone for the date calculation.
Returns
  • A new date one unit after the base date.

public String dateToString (Date date)

Formats a date using the tick unit's formatter.

Parameters
date the date.
Returns
  • The formatted date.

public boolean equals (Object obj)

Tests this unit for equality with another object.

Parameters
obj the object (null permitted).
Returns
  • true or false.

public int getCalendarField ()

Returns a field code that can be used with the Calendar class.

Returns
  • The field code.

public int getCount ()

This method is deprecated.
As of version 1.0.13, use getMultiple().

Returns the unit count.

Returns
  • The unit count.

public int getMultiple ()

Returns the unit multiple.

Returns
  • The unit multiple (always > 0).

public int getRollCount ()

This method is deprecated.
As of version 1.0.13, use the getRollMultiple()

Returns the roll count.

Returns
  • The roll count.

public int getRollMultiple ()

Returns the roll unit multiple.

Returns
  • The roll unit multiple.

public int getRollUnit ()

This method is deprecated.
As of version 1.0.13, use getRollUnitType().

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).

Returns
  • The roll unit.

public DateTickUnitType getRollUnitType ()

Returns the roll unit type.

Returns
  • The roll unit type (never null).

public int getUnit ()

This method is deprecated.
As of 1.0.13, use the getUnitType() method.

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.

Returns
  • The date unit.

public DateTickUnitType getUnitType ()

Returns the unit type.

Returns
  • The unit type (never null).

public int hashCode ()

Returns a hash code for this object.

Returns
  • A hash code.

public Date rollDate (Date base, TimeZone zone)

Rolls the date forward by the amount specified by the roll unit and count.

Parameters
base the base date.
zone the time zone.
Returns
  • The rolled date.

public Date rollDate (Date base)

Rolls the date forward by the amount specified by the roll unit and count.

Parameters
base the base date.
Returns
  • The rolled date.

public String toString ()

Returns a string representation of this instance, primarily used for debugging purposes.

Returns
  • A string representation of this instance.

public String valueToString (double milliseconds)

Formats a value.

Parameters
milliseconds date in milliseconds since 01-01-1970.
Returns
  • The formatted date.