public class

DateTimeAxis

extends Axis<T extends Comparable<T>, U>
java.lang.Object
   ↳ com.shinobicontrols.charts.Axis<T extends java.lang.Comparable<T>, U>
     ↳ com.shinobicontrols.charts.DateTimeAxis

Class Overview

Subclass of Axis that is designed to work with date/time data points.

The value units for tick marks are of type Date. The frequency units for tick marks are of type DateFrequency.

DateTimeAxis is appropriate for any temporal data which is representable using java.util.Date or its subclasses, and will accept Data objects parametrized to those types.

Summary

Public Constructors
DateTimeAxis()
Constructs a DateTimeAxis.
DateTimeAxis(DateRange defaultRange)
Constructs a DateTimeAxis with the specified range set as its default range.
Public Methods
void addRepeatedSkipRange(RepeatedTimePeriod repeatedTimePeriod)
Using the given RepeatedTimePeriod, this axis generates an appropriate set of ranges to skip over, based on the length of the time period and the frequency it repeats at.
void disableTickMarkCaching(boolean disableTickMarkCaching)
Sets whether or not tick mark caching will be disabled.
String getFormattedString(Date value)
Gets a string representing the current value.
DateFormat getLabelFormat()
Gets the label format you have supplied.
List<RepeatedTimePeriod> getRepeatedSkipRanges()
Returns an unmodifiable list of the RepeatedTimePeriod objects that have been added to this axis.
final double getZoomLevel()
Returns the current zoom level, relative to this axis' default range.
boolean isTickMarkCachingDisabled()
Whether or not tick mark caching is disabled.
void removeAllRepeatedSkipRanges()
Removes all RepeatedTimePeriod objects from this axis and as a result of the skip ranges that were generated for them.
void removeRepeatedSkipRange(RepeatedTimePeriod repeatedTimePeriod)
Removes all the skip ranges that were generated as a result of adding the given RepeatedTimePeriod.
void setLabelFormat(DateFormat dateFormat)
Sets the label format.
Protected Methods
Date transformChartValueToUserValue(Date chartValue)
Transforms an internal data value into an externally visible value.
Date transformUserValueToChartValue(Date userValue)
Transforms an externally visible data value into an internal value.
[Expand]
Inherited Methods
From class com.shinobicontrols.charts.Axis
From class java.lang.Object

Public Constructors

public DateTimeAxis ()

Constructs a DateTimeAxis.

public DateTimeAxis (DateRange defaultRange)

Constructs a DateTimeAxis with the specified range set as its default range. See setDefaultRange(Range) for the implications of setting this type of range.

Parameters
defaultRange The range to set as the default range for this axis

Public Methods

public void addRepeatedSkipRange (RepeatedTimePeriod repeatedTimePeriod)

Using the given RepeatedTimePeriod, this axis generates an appropriate set of ranges to skip over, based on the length of the time period and the frequency it repeats at.

The range over which this axis uses to generate the skip ranges will depend on the data range of the Series associated with this axis as well as any default range set on it. If no suitable range is available, the skip range generation will be deferred until a range becomes available. Equally, if the range over which skip ranges can be generated changes, such as when a new default range is set or more data is added, the repeated skip ranges will be re-generated.

Note, getStart() will be used as the starting point for generating the skip ranges but will go both forwards and backwards along the range determined by the axis. Therefore it does not matter whether the start date of the repeated time period is inside or outside this range, however, it may be more performant to ensure it is near the start of this axis' default range or data range, whichever is the earlier of the two.

Adding a repeated skip range will automatically reload the data in the chart.

Parameters
repeatedTimePeriod a time period that describes a range to be skip at repeated intervals

public void disableTickMarkCaching (boolean disableTickMarkCaching)

Sets whether or not tick mark caching will be disabled. This value is false by default, that is, caching is utilized during the tick mark calculation process. When caching is employed you may notice unexpected major tick mark values upon a change in the tick mark frequency. If this is undesirable you may choose to disable caching, using this method. In this case, each tick mark calculation phase is based on the same internally set reference point. In some cases this may cause performance problems.

Parameters
disableTickMarkCaching set to true if you wish to disable tick mark caching

public String getFormattedString (Date value)

Gets a string representing the current value. This is a convenience method which you may use to format values as the axis does. It is called from within the chart, but it is generally unnecessary to override it, as the format objects (either internal or user-supplied) are intended for this kind of customization.

Parameters
value The value to set
Returns
  • The formatted tick mark label string

public DateFormat getLabelFormat ()

Gets the label format you have supplied. Note that if you do not supply a format object, the axis will use its internal one

Returns
  • The label format

public List<RepeatedTimePeriod> getRepeatedSkipRanges ()

Returns an unmodifiable list of the RepeatedTimePeriod objects that have been added to this axis.

Returns

public final double getZoomLevel ()

Returns the current zoom level, relative to this axis' default range.

Returns
  • the current zoom level for this axis

public boolean isTickMarkCachingDisabled ()

Whether or not tick mark caching is disabled.

Returns
  • whether or not tick mark caching will be disabled.

public void removeAllRepeatedSkipRanges ()

Removes all RepeatedTimePeriod objects from this axis and as a result of the skip ranges that were generated for them. Calling this when there are no repeated skip ranges on this axis has no effect.

public void removeRepeatedSkipRange (RepeatedTimePeriod repeatedTimePeriod)

Removes all the skip ranges that were generated as a result of adding the given RepeatedTimePeriod. Removing a repeated time period that has not already been added to this axis will have no effect.

Parameters
repeatedTimePeriod the repeated time period to remove

public void setLabelFormat (DateFormat dateFormat)

Sets the label format. This will override the default behavior of using an internal format and instead, the provided DateFormat object will be used. Passing in a null to this method will reset the behavior back to default, where the internal format will be used. If you subclass SimpleDateFormat to supply your own implementation you will probably want to override the (java.util.Date, java.lang.StringBuffer, java.text.FieldPosition) method.

Parameters
dateFormat The format to set
See Also

Protected Methods

protected Date transformChartValueToUserValue (Date chartValue)

Transforms an internal data value into an externally visible value.

This allows you to add a mapping between your data and the chart, and you do not need to override this unless you have an advanced customization scenario. The default behavior does nothing.

Parameters
chartValue The chart's data value
Returns
  • Your data value

protected Date transformUserValueToChartValue (Date userValue)

Transforms an externally visible data value into an internal value.

This allows you to add a mapping between your data and the chart, and you do not need to override this unless you have an advanced customization scenario. The default behavior does nothing.

Parameters
userValue Your data value
Returns
  • The chart's data value