java.lang.Object | |||
↳ | org.jfree.chart.axis.Axis | ||
↳ | org.jfree.chart.axis.ValueAxis | ||
↳ | org.jfree.chart.axis.DateAxis |
The base class for axes that display dates. You will find it easier to
understand how this axis works if you bear in mind that it really
displays/measures integer (or long) data, where the integers are
milliseconds since midnight, 1-Jan-1970. When displaying tick labels, the
millisecond values are converted back to dates using a
DateFormat
instance.
You can also create a Timeline
and supply in
the constructor to create an axis that only contains certain domain values.
For example, this allows you to create a date axis that only contains
working days.
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
double | DEFAULT_AUTO_RANGE_MINIMUM_SIZE_IN_MILLISECONDS | The default minimum auto range size. |
[Expand]
Inherited Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
DEFAULT_ANCHOR_DATE | The default anchor date. | ||||||||||
DEFAULT_DATE_RANGE | The default axis range. | ||||||||||
DEFAULT_DATE_TICK_UNIT | The default date tick unit. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a date axis with no label.
| |||||||||||
Creates a date axis with the specified label.
| |||||||||||
This constructor is deprecated.
From 1.0.11 onwards, use
DateAxis(String, TimeZone, Locale) instead, to explicitly set the locale.
| |||||||||||
Creates a date axis.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Calculates the value of the highest visible tick on the axis.
| |||||||||||
Calculates the value of the lowest visible tick on the axis.
| |||||||||||
Returns a clone of the object.
| |||||||||||
Configures the axis to work with the specified plot.
| |||||||||||
This method is deprecated.
Since 1.0.11, use
createStandardDateTickUnits(TimeZone, Locale) to explicitly set the locale as well as the
time zone.
| |||||||||||
Returns a collection of standard date tick units.
| |||||||||||
Returns a collection of standard date tick units that uses the default
time zone.
| |||||||||||
Translates a date to Java2D coordinates, based on the range displayed by
this axis for the specified data area.
| |||||||||||
Draws the axis on a Java 2D graphics device (such as the screen or a
printer).
| |||||||||||
Tests this axis for equality with an arbitrary object.
| |||||||||||
Returns the date format override.
| |||||||||||
Returns the latest date visible on the axis.
| |||||||||||
Returns the earliest date visible on the axis.
| |||||||||||
Returns the tick mark position (start, middle or end of the time period).
| |||||||||||
Returns the tick unit for the axis.
| |||||||||||
Returns the time zone for the axis.
| |||||||||||
Returns the underlying timeline used by this axis.
| |||||||||||
Returns a hash code for this object.
| |||||||||||
Returns
true if the axis hides this value, and
false otherwise. | |||||||||||
Translates a Java2D coordinate into the corresponding data value.
| |||||||||||
Calculates the positions of the tick labels for the axis, storing the
results in the tick label list (ready for drawing).
| |||||||||||
Sets the date format override.
| |||||||||||
Sets the maximum date visible on the axis and sends an
AxisChangeEvent to all registered listeners. | |||||||||||
Sets the minimum date visible on the axis and sends an
AxisChangeEvent to all registered listeners. | |||||||||||
Sets the range for the axis, if requested, sends an
AxisChangeEvent to all registered listeners. | |||||||||||
Sets the axis range and sends an
AxisChangeEvent to all
registered listeners. | |||||||||||
Sets the upper and lower bounds for the axis and sends an
AxisChangeEvent to all registered listeners. | |||||||||||
Sets the axis range and sends an
AxisChangeEvent to all
registered listeners. | |||||||||||
Sets the tick mark position (start, middle or end of the time period)
and sends an
AxisChangeEvent to all registered listeners. | |||||||||||
Sets the tick unit for the axis.
| |||||||||||
Sets the tick unit attribute.
| |||||||||||
Sets the time zone for the axis and sends an
AxisChangeEvent to
all registered listeners. | |||||||||||
Sets the underlying timeline to use for this axis.
| |||||||||||
Translates the data value to the display coordinates (Java 2D User Space)
of the chart.
| |||||||||||
Zooms in on the current range.
|
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Rescales the axis to ensure that all data is visible.
| |||||||||||
Returns the first "standard" date (based on the specified field and
units).
| |||||||||||
Returns the previous "standard" date, for a given date and tick unit.
| |||||||||||
Recalculates the ticks for the date axis.
| |||||||||||
Recalculates the ticks for the date axis.
| |||||||||||
Selects an appropriate tick value for the axis.
| |||||||||||
Selects an appropriate tick size for the axis.
| |||||||||||
Selects an appropriate tick size for the axis.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
The default minimum auto range size.
Creates a date axis with no label.
Creates a date axis with the specified label.
label | the axis label (null permitted).
|
---|
This constructor is deprecated.
From 1.0.11 onwards, use DateAxis(String, TimeZone, Locale)
instead, to explicitly set the locale.
Creates a date axis. A timeline is specified for the axis. This allows special transformations to occur between a domain of values and the values included in the axis.
label | the axis label (null permitted). |
---|---|
zone | the time zone. |
Creates a date axis. A timeline is specified for the axis. This allows special transformations to occur between a domain of values and the values included in the axis.
label | the axis label (null permitted). |
---|---|
zone | the time zone. |
locale | the locale (null not permitted). |
Calculates the value of the highest visible tick on the axis.
unit | date unit to use. |
---|
Calculates the value of the lowest visible tick on the axis.
unit | date unit to use. |
---|
Returns a clone of the object.
CloneNotSupportedException | if some component of the axis does not support cloning. |
---|
Configures the axis to work with the specified plot. If the axis has auto-scaling, then sets the maximum and minimum values.
This method is deprecated.
Since 1.0.11, use createStandardDateTickUnits(TimeZone, Locale)
to explicitly set the locale as well as the
time zone.
Returns a collection of standard date tick units. This collection will
be used by default, but you are free to create your own collection if
you want to (see the
setStandardTickUnits(TickUnitSource)
method inherited
from the ValueAxis
class).
zone | the time zone (null not permitted). |
---|
Returns a collection of standard date tick units. This collection will
be used by default, but you are free to create your own collection if
you want to (see the
setStandardTickUnits(TickUnitSource)
method inherited
from the ValueAxis
class).
zone | the time zone (null not permitted). |
---|---|
locale | the locale (null not permitted). |
Returns a collection of standard date tick units that uses the default
time zone. This collection will be used by default, but you are free
to create your own collection if you want to (see the
setStandardTickUnits(TickUnitSource)
method inherited
from the ValueAxis
class).
Translates a date to Java2D coordinates, based on the range displayed by this axis for the specified data area.
date | the date. |
---|---|
area | the rectangle (in Java2D space) where the data is to be plotted. |
edge | the axis location. |
Draws the axis on a Java 2D graphics device (such as the screen or a printer).
g2 | the graphics device (null not permitted). |
---|---|
cursor | the cursor location. |
plotArea | the area within which the axes and data should be
drawn (null not permitted). |
dataArea | the area within which the data should be drawn
(null not permitted). |
edge | the location of the axis (null not permitted). |
plotState | collects information about the plot
(null permitted). |
null
).
Tests this axis for equality with an arbitrary object.
obj | the object (null permitted). |
---|
Returns the date format override. If this is non-null, then it will be used to format the dates on the axis.
null
).
Returns the latest date visible on the axis.
Returns the earliest date visible on the axis.
Returns the tick mark position (start, middle or end of the time period).
null
).
Returns the tick unit for the axis.
Note: if the autoTickUnitSelection
flag is
true
the tick unit may be changed while the axis is being
drawn, so in that case the return value from this method may be
irrelevant if the method is called before the axis has been drawn.
null
).Returns the time zone for the axis.
null
).Returns the underlying timeline used by this axis.
Returns a hash code for this object.
Returns true
if the axis hides this value, and
false
otherwise.
millis | the data value. |
---|
Translates a Java2D coordinate into the corresponding data value. To perform this translation, you need to know the area used for plotting data, and which edge the axis is located on.
java2DValue | the coordinate in Java2D space. |
---|---|
area | the rectangle (in Java2D space) where the data is to be plotted. |
edge | the axis location. |
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
g2 | the graphics device. |
---|---|
state | the axis state. |
dataArea | the area in which the plot should be drawn. |
edge | the location of the axis. |
Sets the date format override. If this is non-null, then it will be used to format the dates on the axis.
formatter | the date formatter (null permitted).
|
---|
Sets the maximum date visible on the axis and sends an
AxisChangeEvent
to all registered listeners. If
maximumDate
is on or before the current minimum date for
the axis, the minimum date will be shifted to preserve the current
length of the axis.
maximumDate | the date (null not permitted). |
---|
Sets the minimum date visible on the axis and sends an
AxisChangeEvent
to all registered listeners. If
date
is on or after the current maximum date for
the axis, the maximum date will be shifted to preserve the current
length of the axis.
date | the date (null not permitted). |
---|
Sets the range for the axis, if requested, sends an
AxisChangeEvent
to all registered listeners. As a side-effect,
the auto-range flag is set to false
(optional).
range | the range (null not permitted). |
---|---|
turnOffAutoRange | a flag that controls whether or not the auto range is turned off. |
notify | a flag that controls whether or not listeners are notified. |
Sets the axis range and sends an AxisChangeEvent
to all
registered listeners.
lower | the lower bound for the axis. |
---|---|
upper | the upper bound for the axis. |
Sets the upper and lower bounds for the axis and sends an
AxisChangeEvent
to all registered listeners. As a side-effect,
the auto-range flag is set to false.
range | the new range (null not permitted).
|
---|
Sets the axis range and sends an AxisChangeEvent
to all
registered listeners.
lower | the lower bound for the axis. |
---|---|
upper | the upper bound for the axis. |
Sets the tick mark position (start, middle or end of the time period)
and sends an AxisChangeEvent
to all registered listeners.
position | the position (null not permitted).
|
---|
Sets the tick unit for the axis. The auto-tick-unit-selection flag is
set to false
, and registered listeners are notified that
the axis has been changed.
unit | the tick unit. |
---|
Sets the tick unit attribute.
unit | the new tick unit. |
---|---|
notify | notify registered listeners? |
turnOffAutoSelection | turn off auto selection? |
Sets the time zone for the axis and sends an AxisChangeEvent
to
all registered listeners.
zone | the time zone (null not permitted). |
---|
Sets the underlying timeline to use for this axis.
If the timeline is changed, an AxisChangeEvent
is sent to all
registered listeners.
timeline | the timeline. |
---|
Translates the data value to the display coordinates (Java 2D User Space) of the chart.
value | the date to be plotted. |
---|---|
area | the rectangle (in Java2D space) where the data is to be plotted. |
edge | the axis location. |
Zooms in on the current range.
lowerPercent | the new lower bound. |
---|---|
upperPercent | the new upper bound. |
Rescales the axis to ensure that all data is visible.
Returns the first "standard" date (based on the specified field and units).
date | the reference date. |
---|---|
unit | the date tick unit. |
Returns the previous "standard" date, for a given date and tick unit.
date | the reference date. |
---|---|
unit | the tick unit. |
Recalculates the ticks for the date axis.
g2 | the graphics device. |
---|---|
dataArea | the area in which the data is to be drawn. |
edge | the location of the axis. |
Recalculates the ticks for the date axis.
g2 | the graphics device. |
---|---|
dataArea | the area in which the plot should be drawn. |
edge | the location of the axis. |
Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping.
g2 | the graphics device. |
---|---|
dataArea | the area defined by the axes. |
edge | the axis location. |
Selects an appropriate tick size for the axis. The strategy is to display as many ticks as possible (selected from a collection of 'standard' tick units) without the labels overlapping.
g2 | the graphics device. |
---|---|
dataArea | the area defined by the axes. |
edge | the axis location. |
Selects an appropriate tick size for the axis. The strategy is to display as many ticks as possible (selected from a collection of 'standard' tick units) without the labels overlapping.
g2 | the graphics device. |
---|---|
dataArea | the area in which the plot should be drawn. |
edge | the axis location. |