Save This Page
Home » jcommon-1.0.13 » org.jfree » chart » axis » [javadoc | source]
org.jfree.chart.axis
public class: DateAxis [javadoc | source]
java.lang.Object
   org.jfree.chart.axis.Axis
      org.jfree.chart.axis.ValueAxis
         org.jfree.chart.axis.DateAxis

All Implemented Interfaces:
    Cloneable, Serializable, PublicCloneable

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 org.jfree.chart.axis.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.
Field Summary
public static final  DateRange DEFAULT_DATE_RANGE    The default axis range. 
public static final  double DEFAULT_AUTO_RANGE_MINIMUM_SIZE_IN_MILLISECONDS    The default minimum auto range size. 
public static final  DateTickUnit DEFAULT_DATE_TICK_UNIT    The default date tick unit. 
public static final  Date DEFAULT_ANCHOR_DATE    The default anchor date. 
Fields inherited from org.jfree.chart.axis.ValueAxis:
DEFAULT_RANGE,  DEFAULT_AUTO_RANGE,  DEFAULT_INVERTED,  DEFAULT_AUTO_RANGE_MINIMUM_SIZE,  DEFAULT_LOWER_MARGIN,  DEFAULT_UPPER_MARGIN,  DEFAULT_LOWER_BOUND,  DEFAULT_UPPER_BOUND,  DEFAULT_AUTO_TICK_UNIT_SELECTION,  MAXIMUM_TICK_COUNT
Fields inherited from org.jfree.chart.axis.Axis:
DEFAULT_AXIS_VISIBLE,  DEFAULT_AXIS_LABEL_FONT,  DEFAULT_AXIS_LABEL_PAINT,  DEFAULT_AXIS_LABEL_INSETS,  DEFAULT_AXIS_LINE_PAINT,  DEFAULT_AXIS_LINE_STROKE,  DEFAULT_TICK_LABELS_VISIBLE,  DEFAULT_TICK_LABEL_FONT,  DEFAULT_TICK_LABEL_PAINT,  DEFAULT_TICK_LABEL_INSETS,  DEFAULT_TICK_MARKS_VISIBLE,  DEFAULT_TICK_MARK_STROKE,  DEFAULT_TICK_MARK_PAINT,  DEFAULT_TICK_MARK_INSIDE_LENGTH,  DEFAULT_TICK_MARK_OUTSIDE_LENGTH
Constructor:
 public DateAxis() 
 public DateAxis(String label) 
    Creates a date axis with the specified label.
    Parameters:
    label - the axis label (null permitted).
 public DateAxis(String label,
    TimeZone 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.
Method from org.jfree.chart.axis.DateAxis Summary:
autoAdjustRange,   calculateHighestVisibleTickValue,   calculateLowestVisibleTickValue,   clone,   configure,   createStandardDateTickUnits,   createStandardDateTickUnits,   dateToJava2D,   draw,   equals,   getDateFormatOverride,   getMaximumDate,   getMinimumDate,   getTickMarkPosition,   getTickUnit,   getTimeZone,   getTimeline,   hashCode,   isHiddenValue,   java2DToValue,   nextStandardDate,   previousStandardDate,   refreshTicks,   refreshTicksHorizontal,   refreshTicksVertical,   selectAutoTickUnit,   selectHorizontalAutoTickUnit,   selectVerticalAutoTickUnit,   setDateFormatOverride,   setMaximumDate,   setMinimumDate,   setRange,   setRange,   setRange,   setRange,   setTickMarkPosition,   setTickUnit,   setTickUnit,   setTimeZone,   setTimeline,   valueToJava2D,   zoomRange
Methods from org.jfree.chart.axis.ValueAxis:
autoAdjustRange,   calculateAnchorPoint,   centerRange,   clone,   drawAxisLine,   drawTickMarksAndLabels,   equals,   findMaximumTickLabelHeight,   findMaximumTickLabelWidth,   getAutoRangeMinimumSize,   getAutoTickIndex,   getDefaultAutoRange,   getDownArrow,   getFixedAutoRange,   getLeftArrow,   getLowerBound,   getLowerMargin,   getRange,   getRightArrow,   getStandardTickUnits,   getUpArrow,   getUpperBound,   getUpperMargin,   isAutoRange,   isAutoTickUnitSelection,   isInverted,   isNegativeArrowVisible,   isPositiveArrowVisible,   isVerticalTickLabels,   java2DToValue,   lengthToJava2D,   reserveSpace,   resizeRange,   resizeRange,   setAutoRange,   setAutoRange,   setAutoRangeMinimumSize,   setAutoRangeMinimumSize,   setAutoTickIndex,   setAutoTickUnitSelection,   setAutoTickUnitSelection,   setDefaultAutoRange,   setDownArrow,   setFixedAutoRange,   setInverted,   setLeftArrow,   setLowerBound,   setLowerMargin,   setNegativeArrowVisible,   setPositiveArrowVisible,   setRange,   setRange,   setRange,   setRangeAboutValue,   setRangeWithMargins,   setRangeWithMargins,   setRangeWithMargins,   setRightArrow,   setStandardTickUnits,   setUpArrow,   setUpperBound,   setUpperMargin,   setVerticalTickLabels,   valueToJava2D,   zoomRange
Methods from org.jfree.chart.axis.Axis:
addChangeListener,   clone,   configure,   draw,   drawAxisLine,   drawLabel,   equals,   getAxisLinePaint,   getAxisLineStroke,   getFixedDimension,   getLabel,   getLabelAngle,   getLabelEnclosure,   getLabelFont,   getLabelInsets,   getLabelPaint,   getPlot,   getTickLabelFont,   getTickLabelInsets,   getTickLabelPaint,   getTickMarkInsideLength,   getTickMarkOutsideLength,   getTickMarkPaint,   getTickMarkStroke,   hasListener,   isAxisLineVisible,   isTickLabelsVisible,   isTickMarksVisible,   isVisible,   notifyListeners,   refreshTicks,   removeChangeListener,   reserveSpace,   setAxisLinePaint,   setAxisLineStroke,   setAxisLineVisible,   setFixedDimension,   setLabel,   setLabelAngle,   setLabelFont,   setLabelInsets,   setLabelInsets,   setLabelPaint,   setPlot,   setTickLabelFont,   setTickLabelInsets,   setTickLabelPaint,   setTickLabelsVisible,   setTickMarkInsideLength,   setTickMarkOutsideLength,   setTickMarkPaint,   setTickMarkStroke,   setTickMarksVisible,   setVisible
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.chart.axis.DateAxis Detail:
 protected  void autoAdjustRange() 
    Rescales the axis to ensure that all data is visible.
 public Date calculateHighestVisibleTickValue(DateTickUnit unit) 
    Calculates the value of the highest visible tick on the axis.
 public Date calculateLowestVisibleTickValue(DateTickUnit unit) 
    Calculates the value of the lowest visible tick on the axis.
 public Object clone() throws CloneNotSupportedException 
    Returns a clone of the object.
 public  void configure() 
    Configures the axis to work with the specified plot. If the axis has auto-scaling, then sets the maximum and minimum values.
 public static TickUnitSource createStandardDateTickUnits() 
    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 ValueAxis#setStandardTickUnits(TickUnitSource) method inherited from the ValueAxis class).
 public static TickUnitSource createStandardDateTickUnits(TimeZone zone) 
 public double dateToJava2D(Date date,
    Rectangle2D area,
    RectangleEdge edge) 
    Translates a date to Java2D coordinates, based on the range displayed by this axis for the specified data area.
 public AxisState draw(Graphics2D g2,
    double cursor,
    Rectangle2D plotArea,
    Rectangle2D dataArea,
    RectangleEdge edge,
    PlotRenderingInfo plotState) 
    Draws the axis on a Java 2D graphics device (such as the screen or a printer).
 public boolean equals(Object obj) 
    Tests this axis for equality with an arbitrary object.
 public DateFormat getDateFormatOverride() 
    Returns the date format override. If this is non-null, then it will be used to format the dates on the axis.
 public Date getMaximumDate() 
    Returns the latest date visible on the axis.
 public Date getMinimumDate() 
    Returns the earliest date visible on the axis.
 public DateTickMarkPosition getTickMarkPosition() 
    Returns the tick mark position (start, middle or end of the time period).
 public DateTickUnit getTickUnit() 
    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.

 public TimeZone getTimeZone() 
    Returns the time zone for the axis.
 public Timeline getTimeline() 
    Returns the underlying timeline used by this axis.
 public int hashCode() 
    Returns a hash code for this object.
 public boolean isHiddenValue(long millis) 
    Returns true if the axis hides this value, and false otherwise.
 public double java2DToValue(double java2DValue,
    Rectangle2D area,
    RectangleEdge edge) 
    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.
 protected Date nextStandardDate(Date date,
    DateTickUnit unit) 
    Returns the first "standard" date (based on the specified field and units).
 protected Date previousStandardDate(Date date,
    DateTickUnit unit) 
    Returns the previous "standard" date, for a given date and tick unit.
 public List refreshTicks(Graphics2D g2,
    AxisState state,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 protected List refreshTicksHorizontal(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Recalculates the ticks for the date axis.
 protected List refreshTicksVertical(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Recalculates the ticks for the date axis.
 protected  void selectAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    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.
 protected  void selectHorizontalAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    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.
 protected  void selectVerticalAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    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.
 public  void setDateFormatOverride(DateFormat formatter) 
    Sets the date format override. If this is non-null, then it will be used to format the dates on the axis.
 public  void setMaximumDate(Date maximumDate) 
    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.
 public  void setMinimumDate(Date date) 
    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.
 public  void setRange(Range range) 
    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.
 public  void setRange(Date lower,
    Date upper) 
    Sets the axis range and sends an AxisChangeEvent to all registered listeners.
 public  void setRange(double lower,
    double upper) 
    Sets the axis range and sends an AxisChangeEvent to all registered listeners.
 public  void setRange(Range range,
    boolean turnOffAutoRange,
    boolean notify) 
    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).
 public  void setTickMarkPosition(DateTickMarkPosition position) 
    Sets the tick mark position (start, middle or end of the time period) and sends an AxisChangeEvent to all registered listeners.
 public  void setTickUnit(DateTickUnit unit) 
    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.
 public  void setTickUnit(DateTickUnit unit,
    boolean notify,
    boolean turnOffAutoSelection) 
    Sets the tick unit attribute.
 public  void setTimeZone(TimeZone zone) 
    Sets the time zone for the axis and sends an AxisChangeEvent to all registered listeners.
 public  void setTimeline(Timeline timeline) 
    Sets the underlying timeline to use for this axis.

    If the timeline is changed, an AxisChangeEvent is sent to all registered listeners.

 public double valueToJava2D(double value,
    Rectangle2D area,
    RectangleEdge edge) 
    Translates the data value to the display coordinates (Java 2D User Space) of the chart.
 public  void zoomRange(double lowerPercent,
    double upperPercent) 
    Zooms in on the current range.