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

All Implemented Interfaces:
    Cloneable, Serializable, PublicCloneable

This class extends NumberAxis and handles cycling. Traditional representation of data in the range x0..x1
|-------------------------|
x0 x1
Here, the range bounds are at the axis extremities. With cyclic axis, however, the time is split in "cycles", or "time frames", or the same duration : the period. A cycle axis cannot by definition handle a larger interval than the period :
x1 - x0 >= period
. Thus, at most a full period can be represented with such an axis. The cycle bound is the number between x0 and x1 which marks the beginning of new time frame:
|---------------------|----------------------------|
x0 cb x1
<---previous cycle---><-------current cycle-------->
It is actually a multiple of the period, plus optionally a start offset:
cb = n * period + offset
Thus, by definition, two consecutive cycle bounds period apart, which is precisely why it is called a period. The visual representation of a cyclic axis is like that:
|----------------------------|---------------------|
cb x1|x0 cb
<-------current cycle--------><---previous cycle--->
The cycle bound is at the axis ends, then current cycle is shown, then the last cycle. When using dynamic data, the visual effect is the current cycle erases the last cycle as x grows. Then, the next cycle bound is reached, and the process starts over, erasing the previous cycle. A Cyclic item renderer is provided to do exactly this.
Nested Class Summary:
protected static class  CyclicNumberAxis.CycleBoundTick  A special Number tick that also hold information about the cycle bound mapping for this tick. This is especially useful for having a tick at each axis end with the cycle bound value. See also isBoundMappedToLastCycle() 
Field Summary
static final  long serialVersionUID    For serialization. 
public static  Stroke DEFAULT_ADVANCE_LINE_STROKE    The default axis line stroke. 
public static final  Paint DEFAULT_ADVANCE_LINE_PAINT    The default axis line paint. 
protected  double offset    The offset. 
protected  double period    The period. 
protected  boolean boundMappedToLastCycle    ??. 
protected  boolean advanceLineVisible    A flag that controls whether or not the advance line is visible. 
protected transient  Stroke advanceLineStroke    The advance line stroke. 
protected transient  Paint advanceLinePaint    The advance line paint. 
Fields inherited from org.jfree.chart.axis.NumberAxis:
DEFAULT_AUTO_RANGE_INCLUDES_ZERO,  DEFAULT_AUTO_RANGE_STICKY_ZERO,  DEFAULT_TICK_UNIT,  DEFAULT_VERTICAL_TICK_LABELS
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 CyclicNumberAxis(double period) 
 public CyclicNumberAxis(double period,
    double offset) 
 public CyclicNumberAxis(double period,
    String label) 
    Creates a named CycleNumberAxis with the given period.
    Parameters:
    period - the period.
    label - the label.
 public CyclicNumberAxis(double period,
    double offset,
    String label) 
    Creates a named CycleNumberAxis with the given period and offset.
    Parameters:
    period - the period.
    offset - the offset.
    label - the label.
Method from org.jfree.chart.axis.CyclicNumberAxis Summary:
calculateAnchorPoint,   centerRange,   draw,   drawTickMarksAndLabels,   equals,   getAdvanceLinePaint,   getAdvanceLineStroke,   getCycleBound,   getOffset,   getPeriod,   isAdvanceLineVisible,   isBoundMappedToLastCycle,   java2DToValue,   refreshTicksHorizontal,   refreshVerticalTicks,   reserveSpace,   selectHorizontalAutoTickUnit,   selectVerticalAutoTickUnit,   setAdvanceLinePaint,   setAdvanceLineStroke,   setAdvanceLineVisible,   setAutoRangeMinimumSize,   setBoundMappedToLastCycle,   setFixedAutoRange,   setOffset,   setPeriod,   setRange,   valueToJava2D
Methods from org.jfree.chart.axis.NumberAxis:
autoAdjustRange,   calculateHighestVisibleTickValue,   calculateLowestVisibleTickValue,   calculateVisibleTickCount,   clone,   configure,   createIntegerTickUnits,   createIntegerTickUnits,   createStandardTickUnits,   createStandardTickUnits,   draw,   equals,   estimateMaximumTickLabelHeight,   estimateMaximumTickLabelWidth,   getAutoRangeIncludesZero,   getAutoRangeStickyZero,   getMarkerBand,   getNumberFormatOverride,   getRangeType,   getTickUnit,   hashCode,   java2DToValue,   refreshTicks,   refreshTicksHorizontal,   refreshTicksVertical,   selectAutoTickUnit,   selectHorizontalAutoTickUnit,   selectVerticalAutoTickUnit,   setAutoRangeIncludesZero,   setAutoRangeStickyZero,   setMarkerBand,   setNumberFormatOverride,   setRangeType,   setTickUnit,   setTickUnit,   valueToJava2D
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.CyclicNumberAxis Detail:
 protected float[] calculateAnchorPoint(ValueTick tick,
    double cursor,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Calculates the anchor point for a tick.
 public  void centerRange(double value) 
    Centers the range about the given value.
 public AxisState draw(Graphics2D g2,
    double cursor,
    Rectangle2D plotArea,
    Rectangle2D dataArea,
    RectangleEdge edge,
    PlotRenderingInfo plotState) 
    Draws the axis.
 protected AxisState drawTickMarksAndLabels(Graphics2D g2,
    double cursor,
    Rectangle2D plotArea,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Draws the tick marks and labels.
 public boolean equals(Object obj) 
    Tests the axis for equality with another object.
 public Paint getAdvanceLinePaint() 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public Stroke getAdvanceLineStroke() 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public double getCycleBound() 
    The cycle bound is defined as the higest value x such that "offset + period * i = x", with i and integer and x < range.getUpperBound() This is the value which is at both ends of the axis : x...up|low...x The values from x to up are the valued in the current cycle. The values from low to x are the valued in the previous cycle.
 public double getOffset() 
    The cycle bound is a multiple of the period, plus optionally a start offset.

    cb = n * period + offset

 public double getPeriod() 
    The cycle bound is a multiple of the period, plus optionally a start offset.

    cb = n * period + offset

 public boolean isAdvanceLineVisible() 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public boolean isBoundMappedToLastCycle() 
    The cycle bound can be associated either with the current or with the last cycle. It's up to the user's choice to decide which, as this is just a convention. By default, the cycle bound is mapped to the current cycle.
    Note that this has no effect on visual appearance, as the cycle bound is mapped successively for both axis ends. Use this function for correct results in translateValueToJava2D.
 public double java2DToValue(double java2DValue,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Converts a coordinate from Java 2D space to data space.
 protected List refreshTicksHorizontal(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Builds a list of ticks for the axis. This method is called when the axis is at the top or bottom of the chart (so the axis is "horizontal").
 protected List refreshVerticalTicks(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Builds a list of ticks for the axis. This method is called when the axis is at the left or right of the chart (so the axis is "vertical").
 public AxisSpace reserveSpace(Graphics2D g2,
    Plot plot,
    Rectangle2D plotArea,
    RectangleEdge edge,
    AxisSpace space) 
    Reserve some space on each axis side because we draw a centered label at each extremity.
 protected  void selectHorizontalAutoTickUnit(Graphics2D g2,
    Rectangle2D drawArea,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Selects a tick unit when the axis is displayed horizontally.
 protected  void selectVerticalAutoTickUnit(Graphics2D g2,
    Rectangle2D drawArea,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Selects a tick unit when the axis is displayed vertically.
 public  void setAdvanceLinePaint(Paint paint) 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public  void setAdvanceLineStroke(Stroke stroke) 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public  void setAdvanceLineVisible(boolean visible) 
    The advance line is the line drawn at the limit of the current cycle, when erasing the previous cycle.
 public  void setAutoRangeMinimumSize(double size,
    boolean notify) 
    This function is nearly useless since the auto range is fixed for this class to the period. The period is extended if necessary to fit the minimum size.
 public  void setBoundMappedToLastCycle(boolean boundMappedToLastCycle) 
    The cycle bound can be associated either with the current or with the last cycle. It's up to the user's choice to decide which, as this is just a convention. By default, the cycle bound is mapped to the current cycle.
    Note that this has no effect on visual appearance, as the cycle bound is mapped successively for both axis ends. Use this function for correct results in valueToJava2D.
 public  void setFixedAutoRange(double length) 
    The auto range is fixed for this class to the period by default. This function will thus set a new period.
 public  void setOffset(double offset) 
    The cycle bound is a multiple of the period, plus optionally a start offset.

    cb = n * period + offset

 public  void setPeriod(double period) 
    The cycle bound is a multiple of the period, plus optionally a start offset.

    cb = n * period + offset

 public  void setRange(Range range,
    boolean turnOffAutoRange,
    boolean notify) 
    Sets a new axis range. The period is extended to fit the range size, if necessary.
 public double valueToJava2D(double value,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Translates a value from data space to Java 2D space.