public class PeriodAxis extends ValueAxis implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable
RegularTimePeriod. This axis works when
displayed across the bottom or top of a plot, but is broken for display at
the left or right of charts.| Modifier and Type | Field and Description |
|---|---|
private java.lang.Class |
autoRangeTimePeriodClass
The
RegularTimePeriod subclass used to automatically determine
the axis range. |
private java.util.Calendar |
calendar
A calendar used for date manipulations in the current time zone and
locale.
|
private RegularTimePeriod |
first
The first time period in the overall range.
|
private PeriodAxisLabelInfo[] |
labelInfo
Info for each labeling band.
|
private RegularTimePeriod |
last
The last time period in the overall range.
|
private java.util.Locale |
locale
The locale (never
null). |
private java.lang.Class |
majorTickTimePeriodClass
Indicates the
RegularTimePeriod subclass that is used to
determine the spacing of the major tick marks. |
private float |
minorTickMarkInsideLength
The length of the tick mark inside the data area (zero permitted).
|
private float |
minorTickMarkOutsideLength
The length of the tick mark outside the data area (zero permitted).
|
private java.awt.Paint |
minorTickMarkPaint
The paint used to draw tick marks.
|
private java.awt.Stroke |
minorTickMarkStroke
The stroke used to draw tick marks.
|
private boolean |
minorTickMarksVisible
A flag that indicates whether or not tick marks are visible for the
axis.
|
private java.lang.Class |
minorTickTimePeriodClass
Indicates the
RegularTimePeriod subclass that is used to
determine the spacing of the minor tick marks. |
private static long |
serialVersionUID
For serialization.
|
private java.util.TimeZone |
timeZone
The time zone used to convert 'first' and 'last' to absolute
milliseconds.
|
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_COUNTDEFAULT_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 |
|---|
PeriodAxis(java.lang.String label)
Creates a new axis.
|
PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last)
Creates a new axis.
|
PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last,
java.util.TimeZone timeZone)
Deprecated.
As of version 1.0.13, you should use the constructor that
specifies a Locale also.
|
PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last,
java.util.TimeZone timeZone,
java.util.Locale locale)
Creates a new axis.
|
| Modifier and Type | Method and Description |
|---|---|
protected void |
autoAdjustRange()
Rescales the axis to ensure that all data is visible.
|
java.lang.Object |
clone()
Returns a clone of the axis.
|
void |
configure()
Configures the axis to work with the current plot.
|
private RegularTimePeriod |
createInstance(java.lang.Class periodClass,
java.util.Date millisecond,
java.util.TimeZone zone,
java.util.Locale locale)
A utility method used to create a particular subclass of the
RegularTimePeriod class that includes the specified millisecond,
assuming the specified time zone. |
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 on a Java 2D graphics device (such as the screen or a
printer).
|
protected AxisState |
drawTickLabels(int band,
java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the tick labels for one "band" of time periods.
|
protected void |
drawTickMarks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the tick marks for the axis.
|
protected void |
drawTickMarksHorizontal(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the major and minor tick marks for an axis that lies at the top or
bottom of the plot.
|
protected void |
drawTickMarksVertical(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws the tick marks for a vertical axis.
|
boolean |
equals(java.lang.Object obj)
Tests the axis for equality with an arbitrary object.
|
java.lang.Class |
getAutoRangeTimePeriodClass()
Returns the class used to create the first and last time periods for
the axis range when the auto-range flag is set to
true. |
RegularTimePeriod |
getFirst()
Returns the first time period in the axis range.
|
PeriodAxisLabelInfo[] |
getLabelInfo()
Returns an array of label info records.
|
RegularTimePeriod |
getLast()
Returns the last time period in the axis range.
|
java.util.Locale |
getLocale()
Returns the locale for this axis.
|
java.lang.Class |
getMajorTickTimePeriodClass()
Returns the class that controls the spacing of the major tick marks.
|
float |
getMinorTickMarkInsideLength()
Returns the inside length for the minor tick marks.
|
float |
getMinorTickMarkOutsideLength()
Returns the outside length for the minor tick marks.
|
java.awt.Paint |
getMinorTickMarkPaint()
Returns the paint used to display minor tick marks, if they are
visible.
|
java.awt.Stroke |
getMinorTickMarkStroke()
Returns the stroke used to display minor tick marks, if they are
visible.
|
java.lang.Class |
getMinorTickTimePeriodClass()
Returns the class that controls the spacing of the minor tick marks.
|
java.util.TimeZone |
getTimeZone()
Returns the time zone used to convert the periods defining the axis
range into absolute milliseconds.
|
int |
hashCode()
Returns a hash code for this object.
|
boolean |
isMinorTickMarksVisible()
Returns the flag that controls whether or not minor tick marks
are displayed for the axis.
|
double |
java2DToValue(double java2DValue,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Converts a coordinate in Java2D space to the corresponding data value,
assuming that the axis runs along one edge of the specified dataArea.
|
private void |
readObject(java.io.ObjectInputStream stream)
Provides serialization support.
|
java.util.List |
refreshTicks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Calculates the positions of the ticks for the axis, storing the results
in the tick list (ready for drawing).
|
AxisSpace |
reserveSpace(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D plotArea,
org.jfree.ui.RectangleEdge edge,
AxisSpace space)
Estimates the space (height or width) required to draw the axis.
|
void |
setAutoRangeTimePeriodClass(java.lang.Class c)
Sets the class used to create the first and last time periods for the
axis range when the auto-range flag is set to
true and
sends an AxisChangeEvent to all registered listeners. |
void |
setFirst(RegularTimePeriod first)
Sets the first time period in the axis range and sends an
AxisChangeEvent to all registered listeners. |
void |
setLabelInfo(PeriodAxisLabelInfo[] info)
Sets the array of label info records and sends an
AxisChangeEvent to all registered listeners. |
void |
setLast(RegularTimePeriod last)
Sets the last time period in the axis range and sends an
AxisChangeEvent to all registered listeners. |
void |
setMajorTickTimePeriodClass(java.lang.Class c)
Sets the class that controls the spacing of the major tick marks, and
sends an
AxisChangeEvent to all registered listeners. |
void |
setMinorTickMarkInsideLength(float length)
Sets the inside length of the minor tick marks and sends an
AxisChangeEvent to all registered listeners. |
void |
setMinorTickMarkOutsideLength(float length)
Sets the outside length of the minor tick marks and sends an
AxisChangeEvent to all registered listeners. |
void |
setMinorTickMarkPaint(java.awt.Paint paint)
Sets the paint used to display minor tick marks, if they are
visible, and sends a
AxisChangeEvent to all registered
listeners. |
void |
setMinorTickMarkStroke(java.awt.Stroke stroke)
Sets the stroke used to display minor tick marks, if they are
visible, and sends a
AxisChangeEvent to all registered
listeners. |
void |
setMinorTickMarksVisible(boolean visible)
Sets the flag that controls whether or not minor tick marks
are displayed for the axis, and sends a
AxisChangeEvent
to all registered listeners. |
void |
setMinorTickTimePeriodClass(java.lang.Class c)
Sets the class that controls the spacing of the minor tick marks, and
sends an
AxisChangeEvent to all registered listeners. |
void |
setRange(Range range,
boolean turnOffAutoRange,
boolean notify)
Sets the range for the axis, if requested, sends an
AxisChangeEvent to all registered listeners. |
void |
setTimeZone(java.util.TimeZone zone)
Sets the time zone that is used to convert the time periods into
absolute milliseconds.
|
double |
valueToJava2D(double value,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Converts a data value to a coordinate in Java2D space, assuming that the
axis runs along one edge of the specified dataArea.
|
private void |
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
|
calculateAnchorPoint, centerRange, drawAxisLine, drawTickMarksAndLabels, 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, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMinorTickCount, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels, zoomRangeaddChangeListener, createAndAddEntity, createAttributedLabel, drawAttributedLabel, drawLabel, fireChangeEvent, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, labelAnchorH, labelAnchorV, labelLocationX, labelLocationY, notifyListeners, removeChangeListener, setAttributedLabel, setAttributedLabel, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelLocation, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisibleprivate static final long serialVersionUID
private RegularTimePeriod first
private RegularTimePeriod last
private java.util.TimeZone timeZone
private java.util.Locale locale
null).private java.util.Calendar calendar
private java.lang.Class autoRangeTimePeriodClass
RegularTimePeriod subclass used to automatically determine
the axis range.private java.lang.Class majorTickTimePeriodClass
RegularTimePeriod subclass that is used to
determine the spacing of the major tick marks.private boolean minorTickMarksVisible
private java.lang.Class minorTickTimePeriodClass
RegularTimePeriod subclass that is used to
determine the spacing of the minor tick marks.private float minorTickMarkInsideLength
private float minorTickMarkOutsideLength
private transient java.awt.Stroke minorTickMarkStroke
private transient java.awt.Paint minorTickMarkPaint
private PeriodAxisLabelInfo[] labelInfo
public PeriodAxis(java.lang.String label)
label - the axis label.public PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last)
label - the axis label (null permitted).first - the first time period in the axis range
(null not permitted).last - the last time period in the axis range
(null not permitted).public PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last,
java.util.TimeZone timeZone)
label - the axis label (null permitted).first - the first time period in the axis range
(null not permitted).last - the last time period in the axis range
(null not permitted).timeZone - the time zone (null not permitted).public PeriodAxis(java.lang.String label,
RegularTimePeriod first,
RegularTimePeriod last,
java.util.TimeZone timeZone,
java.util.Locale locale)
label - the axis label (null permitted).first - the first time period in the axis range
(null not permitted).last - the last time period in the axis range
(null not permitted).timeZone - the time zone (null not permitted).locale - the locale (null not permitted).public RegularTimePeriod getFirst()
null).public void setFirst(RegularTimePeriod first)
AxisChangeEvent to all registered listeners.first - the time period (null not permitted).public RegularTimePeriod getLast()
null).public void setLast(RegularTimePeriod last)
AxisChangeEvent to all registered listeners.last - the time period (null not permitted).public java.util.TimeZone getTimeZone()
null).public void setTimeZone(java.util.TimeZone zone)
zone - the time zone (null not permitted).public java.util.Locale getLocale()
null).public java.lang.Class getAutoRangeTimePeriodClass()
true.null).public void setAutoRangeTimePeriodClass(java.lang.Class c)
true and
sends an AxisChangeEvent to all registered listeners.c - the class (null not permitted).public java.lang.Class getMajorTickTimePeriodClass()
null).public void setMajorTickTimePeriodClass(java.lang.Class c)
AxisChangeEvent to all registered listeners.c - the class (a subclass of RegularTimePeriod is
expected).public boolean isMinorTickMarksVisible()
isMinorTickMarksVisible in class AxisAxis.setMinorTickMarksVisible(boolean)public void setMinorTickMarksVisible(boolean visible)
AxisChangeEvent
to all registered listeners.setMinorTickMarksVisible in class Axisvisible - the flag.Axis.isMinorTickMarksVisible()public java.lang.Class getMinorTickTimePeriodClass()
null).public void setMinorTickTimePeriodClass(java.lang.Class c)
AxisChangeEvent to all registered listeners.c - the class (a subclass of RegularTimePeriod is
expected).public java.awt.Stroke getMinorTickMarkStroke()
null).public void setMinorTickMarkStroke(java.awt.Stroke stroke)
AxisChangeEvent to all registered
listeners.stroke - the stroke (null not permitted).public java.awt.Paint getMinorTickMarkPaint()
null).public void setMinorTickMarkPaint(java.awt.Paint paint)
AxisChangeEvent to all registered
listeners.paint - the paint (null not permitted).public float getMinorTickMarkInsideLength()
getMinorTickMarkInsideLength in class AxisAxis.getMinorTickMarkOutsideLength(),
Axis.setMinorTickMarkInsideLength(float)public void setMinorTickMarkInsideLength(float length)
AxisChangeEvent to all registered listeners.setMinorTickMarkInsideLength in class Axislength - the length.Axis.getMinorTickMarkInsideLength()public float getMinorTickMarkOutsideLength()
getMinorTickMarkOutsideLength in class AxisAxis.getMinorTickMarkInsideLength(),
Axis.setMinorTickMarkOutsideLength(float)public void setMinorTickMarkOutsideLength(float length)
AxisChangeEvent to all registered listeners.setMinorTickMarkOutsideLength in class Axislength - the length.Axis.getMinorTickMarkInsideLength()public PeriodAxisLabelInfo[] getLabelInfo()
public void setLabelInfo(PeriodAxisLabelInfo[] info)
AxisChangeEvent to all registered listeners.info - the info.public void setRange(Range range, boolean turnOffAutoRange, boolean notify)
AxisChangeEvent to all registered listeners. As a side-effect,
the auto-range flag is set to false (optional).setRange in class ValueAxisrange - the range (null not permitted).turnOffAutoRange - a flag that controls whether or not the auto
range is turned off.notify - a flag that controls whether or not listeners are
notified.ValueAxis.getRange()public void configure()
public AxisSpace reserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
reserveSpace in class ValueAxisg2 - the graphics device.plot - the plot that the axis belongs to.plotArea - the area within which the plot (including axes) should
be drawn.edge - the axis location.space - space already reserved.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 Axisg2 - the graphics device (null not permitted).cursor - the cursor location (determines where to draw the axis).plotArea - the area within which the axes and plot should be drawn.dataArea - the area within which the data should be drawn.edge - the axis location (null not permitted).plotState - collects information about the plot
(null permitted).null).protected void drawTickMarks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
g2 - the graphics device.state - the axis state.dataArea - the data area.edge - the edge.protected void drawTickMarksHorizontal(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
g2 - the graphics device.state - the axis state.dataArea - the data area.edge - the edge.protected void drawTickMarksVertical(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
g2 - the graphics device.state - the axis state.dataArea - the data area.edge - the edge.protected AxisState drawTickLabels(int band, java.awt.Graphics2D g2, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
band - the band index (zero-based).g2 - the graphics device.state - the axis state.dataArea - the data area.edge - the edge where the axis is located.public java.util.List refreshTicks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
refreshTicks in class Axisg2 - the graphics device.state - the axis state.dataArea - the area inside the axes.edge - the edge on which the axis is located.public double valueToJava2D(double value,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Note that it is possible for the coordinate to fall outside the area.
valueToJava2D in class ValueAxisvalue - the data value.area - the area for plotting the data.edge - the edge along which the axis lies.ValueAxis.java2DToValue(double, Rectangle2D, RectangleEdge)public double java2DToValue(double java2DValue,
java.awt.geom.Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
java2DToValue in class ValueAxisjava2DValue - the coordinate in Java2D space.area - the area in which the data is plotted.edge - the edge along which the axis lies.ValueAxis.valueToJava2D(double, Rectangle2D, RectangleEdge)protected void autoAdjustRange()
autoAdjustRange in class ValueAxispublic boolean equals(java.lang.Object obj)
public int hashCode()
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
private RegularTimePeriod createInstance(java.lang.Class periodClass, java.util.Date millisecond, java.util.TimeZone zone, java.util.Locale locale)
RegularTimePeriod class that includes the specified millisecond,
assuming the specified time zone.periodClass - the class.millisecond - the time.zone - the time zone.locale - the locale.private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - the output stream.java.io.IOException - if there is an I/O error.private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - the input stream.java.io.IOException - if there is an I/O error.java.lang.ClassNotFoundException - if there is a classpath problem.