public class CyclicNumberAxis extends NumberAxis
|-------------------------| x0 x1Here, 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 + offsetThus, 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.
Modifier and Type | Class and Description |
---|---|
protected static class |
CyclicNumberAxis.CycleBoundTick
A special Number tick that also hold information about the cycle bound
mapping for this tick.
|
Modifier and Type | Field and Description |
---|---|
protected java.awt.Paint |
advanceLinePaint
The advance line paint.
|
protected java.awt.Stroke |
advanceLineStroke
The advance line stroke.
|
protected boolean |
advanceLineVisible
A flag that controls whether or not the advance line is visible.
|
protected boolean |
boundMappedToLastCycle
??.
|
static java.awt.Paint |
DEFAULT_ADVANCE_LINE_PAINT
The default axis line paint.
|
static java.awt.Stroke |
DEFAULT_ADVANCE_LINE_STROKE
The default axis line stroke.
|
protected double |
offset
The offset.
|
protected double |
period
The period.
|
DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT, DEFAULT_VERTICAL_TICK_LABELS
DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_AUTO_TICK_UNIT_SELECTION, DEFAULT_INVERTED, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE
Constructor and Description |
---|
CyclicNumberAxis(double period)
Creates a CycleNumberAxis with the given period.
|
CyclicNumberAxis(double period,
double offset)
Creates a CycleNumberAxis with the given period and offset.
|
CyclicNumberAxis(double period,
double offset,
java.lang.String label)
Creates a named CycleNumberAxis with the given period and offset.
|
CyclicNumberAxis(double period,
java.lang.String label)
Creates a named CycleNumberAxis with the given period.
|
Modifier and Type | Method and Description |
---|---|
protected float[] |
calculateAnchorPoint(ValueTick tick,
double cursor,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Calculates the anchor point for a tick.
|
void |
centerRange(double value)
Centers the range about the given value.
|
AxisState |
draw(java.awt.Graphics2D g2,
double cursor,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge,
PlotRenderingInfo plotState)
Draws the axis.
|
protected AxisState |
drawTickMarksAndLabels(java.awt.Graphics2D g2,
double cursor,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the tick marks and labels.
|
boolean |
equals(java.lang.Object obj)
Tests the axis for equality with another object.
|
java.awt.Paint |
getAdvanceLinePaint()
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
java.awt.Stroke |
getAdvanceLineStroke()
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
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.
|
double |
getOffset()
The cycle bound is a multiple of the period, plus optionally a start
offset.
|
double |
getPeriod()
The cycle bound is a multiple of the period, plus optionally a start
offset.
|
boolean |
isAdvanceLineVisible()
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
boolean |
isBoundMappedToLastCycle()
The cycle bound can be associated either with the current or with the
last cycle.
|
double |
java2DToValue(double java2DValue,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Converts a coordinate from Java 2D space to data space.
|
protected java.util.List |
refreshTicksHorizontal(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Builds a list of ticks for the axis.
|
protected java.util.List |
refreshVerticalTicks(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Builds a list of ticks for the axis.
|
AxisSpace |
reserveSpace(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D plotArea,
org.jfree.ui.RectangleEdge edge,
AxisSpace space)
Reserve some space on each axis side because we draw a centered label at
each extremity.
|
protected void |
selectHorizontalAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D drawArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Selects a tick unit when the axis is displayed horizontally.
|
protected void |
selectVerticalAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D drawArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Selects a tick unit when the axis is displayed vertically.
|
void |
setAdvanceLinePaint(java.awt.Paint paint)
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
void |
setAdvanceLineStroke(java.awt.Stroke stroke)
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
void |
setAdvanceLineVisible(boolean visible)
The advance line is the line drawn at the limit of the current cycle,
when erasing the previous cycle.
|
void |
setAutoRangeMinimumSize(double size,
boolean notify)
This function is nearly useless since the auto range is fixed for this
class to the period.
|
void |
setBoundMappedToLastCycle(boolean boundMappedToLastCycle)
The cycle bound can be associated either with the current or with the
last cycle.
|
void |
setFixedAutoRange(double length)
The auto range is fixed for this class to the period by default.
|
void |
setOffset(double offset)
The cycle bound is a multiple of the period, plus optionally a start
offset.
|
void |
setPeriod(double period)
The cycle bound is a multiple of the period, plus optionally a start
offset.
|
void |
setRange(Range range,
boolean turnOffAutoRange,
boolean notify)
Sets a new axis range.
|
double |
valueToJava2D(double value,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Translates a value from data space to Java 2D space.
|
autoAdjustRange, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, estimateMaximumTickLabelHeight, estimateMaximumTickLabelWidth, getAutoRangeIncludesZero, getAutoRangeStickyZero, getMarkerBand, getNumberFormatOverride, getRangeType, getTickUnit, hashCode, refreshTicks, refreshTicksVertical, selectAutoTickUnit, selectHorizontalAutoTickUnit, selectVerticalAutoTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setRangeType, setTickUnit, setTickUnit
drawAxisLine, findMaximumTickLabelHeight, findMaximumTickLabelWidth, getAutoRangeMinimumSize, getAutoTickIndex, getDefaultAutoRange, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getMinorTickCount, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, lengthToJava2D, pan, resizeRange, resizeRange, resizeRange2, setAutoRange, setAutoRange, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMinorTickCount, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels, zoomRange
addChangeListener, createAndAddEntity, createAttributedLabel, drawAttributedLabel, drawLabel, fireChangeEvent, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, labelAnchorH, labelAnchorV, labelLocationX, labelLocationY, notifyListeners, removeChangeListener, setAttributedLabel, setAttributedLabel, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelLocation, setLabelPaint, setMinorTickMarkInsideLength, setMinorTickMarkOutsideLength, setMinorTickMarksVisible, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
public static java.awt.Stroke DEFAULT_ADVANCE_LINE_STROKE
public static final java.awt.Paint DEFAULT_ADVANCE_LINE_PAINT
protected double offset
protected double period
protected boolean boundMappedToLastCycle
protected boolean advanceLineVisible
protected transient java.awt.Stroke advanceLineStroke
protected transient java.awt.Paint advanceLinePaint
public CyclicNumberAxis(double period)
period
- the period.public CyclicNumberAxis(double period, double offset)
period
- the period.offset
- the offset.public CyclicNumberAxis(double period, java.lang.String label)
period
- the period.label
- the label.public CyclicNumberAxis(double period, double offset, java.lang.String label)
period
- the period.offset
- the offset.label
- the label.public boolean isAdvanceLineVisible()
public void setAdvanceLineVisible(boolean visible)
visible
- the flag.public java.awt.Paint getAdvanceLinePaint()
null
).public void setAdvanceLinePaint(java.awt.Paint paint)
paint
- the paint (null
not permitted).public java.awt.Stroke getAdvanceLineStroke()
null
).public void setAdvanceLineStroke(java.awt.Stroke stroke)
stroke
- the stroke (null
not permitted).public boolean isBoundMappedToLastCycle()
true
if the cycle bound is mapped to the last
cycle, false
if it is bound to the current cycle
(default)public void setBoundMappedToLastCycle(boolean boundMappedToLastCycle)
boundMappedToLastCycle
- Set it to true to map the cycle bound to
the last cycle.protected void selectHorizontalAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
g2
- the graphics device.drawArea
- the drawing area.dataArea
- the data area.edge
- the side of the rectangle on which the axis is displayed.protected void selectVerticalAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
g2
- the graphics device.drawArea
- the drawing area.dataArea
- the data area.edge
- the side of the rectangle on which the axis is displayed.protected float[] calculateAnchorPoint(ValueTick tick, double cursor, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
calculateAnchorPoint
in class ValueAxis
tick
- the tick.cursor
- the cursor.dataArea
- the data area.edge
- the side on which the axis is displayed.protected java.util.List refreshTicksHorizontal(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
refreshTicksHorizontal
in class NumberAxis
g2
- the graphics device.dataArea
- the data area.edge
- the edge.protected java.util.List refreshVerticalTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
g2
- the graphics device.dataArea
- the data area.edge
- the edge.public double java2DToValue(double java2DValue, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
java2DToValue
in class NumberAxis
java2DValue
- the coordinate in Java2D space.dataArea
- the data area.edge
- the edge.NumberAxis.valueToJava2D(double, Rectangle2D, RectangleEdge)
public double valueToJava2D(double value, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
valueToJava2D
in class NumberAxis
value
- the data value.dataArea
- the data area.edge
- the edge.NumberAxis.java2DToValue(double, Rectangle2D, RectangleEdge)
public void centerRange(double value)
centerRange
in class ValueAxis
value
- the data value.public void setAutoRangeMinimumSize(double size, boolean notify)
setAutoRangeMinimumSize
in class ValueAxis
size
- the size.notify
- notify?ValueAxis.setAutoRangeMinimumSize(double,
boolean)
public void setFixedAutoRange(double length)
setFixedAutoRange
in class ValueAxis
length
- the length.ValueAxis.setFixedAutoRange(double)
public void setRange(Range range, boolean turnOffAutoRange, boolean notify)
setRange
in class ValueAxis
range
- the range.turnOffAutoRange
- switch off the auto range.notify
- notify?ValueAxis.setRange(Range, boolean, boolean)
public double getCycleBound()
public double getOffset()
cb = n * period + offset
getCycleBound()
public void setOffset(double offset)
cb = n * period + offset
offset
- The offset to set.getCycleBound()
public double getPeriod()
cb = n * period + offset
getCycleBound()
public void setPeriod(double period)
cb = n * period + offset
period
- The period to set.getCycleBound()
protected AxisState drawTickMarksAndLabels(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
drawTickMarksAndLabels
in class ValueAxis
g2
- the graphics device.cursor
- the cursor.plotArea
- the plot area.dataArea
- the area inside the axes.edge
- the side on which the axis is displayed.public AxisState draw(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)
draw
in class NumberAxis
g2
- the graphics device (null
not permitted).cursor
- the cursor position.plotArea
- the plot area (null
not permitted).dataArea
- the data area (null
not permitted).edge
- the edge (null
not permitted).plotState
- collects information about the plot
(null
permitted).null
).public AxisSpace reserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
reserveSpace
in class ValueAxis
g2
- the graphics device.plot
- the plot.plotArea
- the plot area.edge
- the edge.space
- the space already reserved.public boolean equals(java.lang.Object obj)
equals
in class NumberAxis
obj
- the object to test against.