org.jfree.chart.axis
Interface Timeline
- SegmentedTimeline
An interface that defines the contract for a Timeline.
A Timeline will present a series of values to be used for an axis. Each
Timeline must provide transformation methods between domain values and
timeline values. In theory many transformations are possible. This interface
has been implemented completely in
SegmentedTimeline
.
A timeline can be used as parameter to a
DateAxis
to define the values that this axis
supports. As an example, the
SegmentedTimeline
implements a timeline formed by segments of equal length (ex. days, hours,
minutes) where some segments can be included in the timeline and others
excluded. Therefore timelines like "working days" or "working hours" can be
created where non-working days or non-working hours respectively can be
removed from the timeline, and therefore from the axis. This creates a smooth
plot with equal separation between all included segments.
Because Timelines were created mainly for Date related axis, values are
represented as longs instead of doubles. In this case, the domain value is
just the number of milliseconds since January 1, 1970, 00:00:00 GMT as
defined by the getTime() method of
java.util.Date
.
boolean | containsDomainRange(Date fromDate, Date toDate) - Returns
true if a range of dates are contained in the
timeline.
|
boolean | containsDomainRange(long fromMillisecond, long toMillisecond) - Returns
true if a range of values are contained in the
timeline.
|
boolean | containsDomainValue(Date date) - Returns
true if a date is contained in the timeline values.
|
boolean | containsDomainValue(long millisecond) - Returns
true if a value is contained in the timeline values.
|
long | toMillisecond(long timelineValue) - Translates a value relative to this timeline into a domain value.
|
long | toTimelineValue(Date date) - Translates a date into a value on this timeline.
|
long | toTimelineValue(long millisecond) - Translates a millisecond (as defined by java.util.Date) into an index
along this timeline.
|
containsDomainRange
public boolean containsDomainRange(Date fromDate,
Date toDate)
Returns true
if a range of dates are contained in the
timeline.
fromDate
- the start of the range to verify.toDate
- the end of the range to verify.
true
if the range is contained in the timeline or
false
otherwise
containsDomainRange
public boolean containsDomainRange(long fromMillisecond,
long toMillisecond)
Returns true
if a range of values are contained in the
timeline.
fromMillisecond
- the start of the range to verify.toMillisecond
- the end of the range to verify.
true
if the range is contained in the timeline or
false
otherwise
containsDomainValue
public boolean containsDomainValue(Date date)
Returns true
if a date is contained in the timeline values.
date
- the date to verify.
true
if value is contained in the timeline and
false
otherwise.
containsDomainValue
public boolean containsDomainValue(long millisecond)
Returns true
if a value is contained in the timeline values.
millisecond
- the millisecond.
true
if value is contained in the timeline and
false
otherwise.
toMillisecond
public long toMillisecond(long timelineValue)
Translates a value relative to this timeline into a domain value. The
domain value obtained by this method is not always the same domain value
that could have been supplied to
translateDomainValueToTimelineValue(domainValue).
This is because the original tranformation may not be complete
reversable.
timelineValue
- a timeline value.
toTimelineValue
public long toTimelineValue(Date date)
Translates a date into a value on this timeline.
toTimelineValue
public long toTimelineValue(long millisecond)
Translates a millisecond (as defined by java.util.Date) into an index
along this timeline.
millisecond
- the millisecond.