public abstract class Axis extends java.lang.Object implements java.lang.Cloneable, java.io.Serializable
ValueAxis
) and those that display
categories (CategoryAxis
).Modifier and Type | Field and Description |
---|---|
static java.awt.Font |
DEFAULT_AXIS_LABEL_FONT
The default axis label font.
|
static org.jfree.ui.RectangleInsets |
DEFAULT_AXIS_LABEL_INSETS
The default axis label insets.
|
static java.awt.Paint |
DEFAULT_AXIS_LABEL_PAINT
The default axis label paint.
|
static java.awt.Paint |
DEFAULT_AXIS_LINE_PAINT
The default axis line paint.
|
static java.awt.Stroke |
DEFAULT_AXIS_LINE_STROKE
The default axis line stroke.
|
static boolean |
DEFAULT_AXIS_VISIBLE
The default axis visibility.
|
static java.awt.Font |
DEFAULT_TICK_LABEL_FONT
The default tick label font.
|
static org.jfree.ui.RectangleInsets |
DEFAULT_TICK_LABEL_INSETS
The default tick label insets.
|
static java.awt.Paint |
DEFAULT_TICK_LABEL_PAINT
The default tick label paint.
|
static boolean |
DEFAULT_TICK_LABELS_VISIBLE
The default tick labels visibility.
|
static float |
DEFAULT_TICK_MARK_INSIDE_LENGTH
The default tick mark inside length.
|
static float |
DEFAULT_TICK_MARK_OUTSIDE_LENGTH
The default tick mark outside length.
|
static java.awt.Paint |
DEFAULT_TICK_MARK_PAINT
The default tick paint.
|
static java.awt.Stroke |
DEFAULT_TICK_MARK_STROKE
The default tick stroke.
|
static boolean |
DEFAULT_TICK_MARKS_VISIBLE
The default tick marks visible.
|
protected Range |
extents |
Modifier | Constructor and Description |
---|---|
protected |
Axis(java.lang.String label)
Constructs an axis, using default values where necessary.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(AxisChangeListener listener)
Registers an object for notification of changes to the axis.
|
java.lang.Object |
clone()
Returns a clone of the axis.
|
abstract void |
configure()
Configures the axis to work with the current plot.
|
protected void |
createAndAddEntity(double cursor,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge,
PlotRenderingInfo plotState)
Created an entity for the axis.
|
abstract 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 void |
drawAxisLine(java.awt.Graphics2D g2,
double cursor,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Draws an axis line at the current cursor position and edge.
|
protected AxisState |
drawLabel(java.lang.String label,
java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge,
AxisState state)
Draws the axis label.
|
boolean |
equals(java.lang.Object obj)
Tests this axis for equality with another object.
|
protected void |
fireChangeEvent()
Sends an
AxisChangeEvent to all registered listeners. |
java.awt.Paint |
getAxisLinePaint()
Returns the paint used to draw the axis line.
|
java.awt.Stroke |
getAxisLineStroke()
Returns the stroke used to draw the axis line.
|
Range |
getExtents() |
double |
getFixedDimension()
Returns the fixed dimension for the axis.
|
java.lang.String |
getLabel()
Returns the label for the axis.
|
double |
getLabelAngle()
Returns the angle of the axis label.
|
protected java.awt.geom.Rectangle2D |
getLabelEnclosure(java.awt.Graphics2D g2,
org.jfree.ui.RectangleEdge edge)
Returns a rectangle that encloses the axis label.
|
java.awt.Font |
getLabelFont()
Returns the font for the axis label.
|
org.jfree.ui.RectangleInsets |
getLabelInsets()
Returns the insets for the label (that is, the amount of blank space
that should be left around the label).
|
java.awt.Paint |
getLabelPaint()
Returns the color/shade used to draw the axis label.
|
float |
getMinorTickMarkInsideLength()
Returns the inside length of the minor tick marks.
|
float |
getMinorTickMarkOutsideLength()
Returns the outside length of the minor tick marks.
|
Plot |
getPlot()
Returns the plot that the axis is assigned to.
|
java.awt.Font |
getTickLabelFont()
Returns the font used for the tick labels (if showing).
|
org.jfree.ui.RectangleInsets |
getTickLabelInsets()
Returns the insets for the tick labels.
|
java.awt.Paint |
getTickLabelPaint()
Returns the color/shade used for the tick labels.
|
float |
getTickMarkInsideLength()
Returns the inside length of the tick marks.
|
float |
getTickMarkOutsideLength()
Returns the outside length of the tick marks.
|
java.awt.Paint |
getTickMarkPaint()
Returns the paint used to draw tick marks (if they are showing).
|
java.awt.Stroke |
getTickMarkStroke()
Returns the stroke used to draw tick marks.
|
boolean |
hasListener(java.util.EventListener listener)
Returns
true if the specified object is registered with
the dataset as a listener. |
boolean |
isAxisLineVisible()
A flag that controls whether or not the axis line is drawn.
|
boolean |
isMinorTickMarksVisible()
Returns the flag that indicates whether or not the minor tick marks are
showing.
|
boolean |
isTickLabelsVisible()
Returns a flag indicating whether or not the tick labels are visible.
|
boolean |
isTickMarksVisible()
Returns the flag that indicates whether or not the tick marks are
showing.
|
boolean |
isVisible()
Returns
true if the axis is visible, and
false otherwise. |
protected void |
notifyListeners(AxisChangeEvent event)
Notifies all registered listeners that the axis has changed.
|
abstract 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).
|
void |
removeChangeListener(AxisChangeListener listener)
Deregisters an object for notification of changes to the axis.
|
abstract 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 |
setAxisLinePaint(java.awt.Paint paint)
Sets the paint used to draw the axis line and sends an
AxisChangeEvent to all registered listeners. |
void |
setAxisLineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the axis line and sends an
AxisChangeEvent to all registered listeners. |
void |
setAxisLineVisible(boolean visible)
Sets a flag that controls whether or not the axis line is visible and
sends an
AxisChangeEvent to all registered listeners. |
void |
setExtents(Range range) |
void |
setFixedDimension(double dimension)
Sets the fixed dimension for the axis.
|
void |
setLabel(java.lang.String label)
Sets the label for the axis and sends an
AxisChangeEvent to all
registered listeners. |
void |
setLabelAngle(double angle)
Sets the angle for the label and sends an
AxisChangeEvent to all
registered listeners. |
void |
setLabelFont(java.awt.Font font)
Sets the font for the axis label and sends an
AxisChangeEvent
to all registered listeners. |
void |
setLabelInsets(org.jfree.ui.RectangleInsets insets)
Sets the insets for the axis label, and sends an
AxisChangeEvent
to all registered listeners. |
void |
setLabelInsets(org.jfree.ui.RectangleInsets insets,
boolean notify)
Sets the insets for the axis label, and sends an
AxisChangeEvent
to all registered listeners. |
void |
setLabelPaint(java.awt.Paint paint)
Sets the paint used to draw the axis label 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 |
setMinorTickMarksVisible(boolean flag)
Sets the flag that indicates whether or not the minor tick marks are
showing and sends an
AxisChangeEvent to all registered
listeners. |
void |
setPlot(Plot plot)
Sets a reference to the plot that the axis is assigned to.
|
void |
setTickLabelFont(java.awt.Font font)
Sets the font for the tick labels and sends an
AxisChangeEvent
to all registered listeners. |
void |
setTickLabelInsets(org.jfree.ui.RectangleInsets insets)
Sets the insets for the tick labels and sends an
AxisChangeEvent
to all registered listeners. |
void |
setTickLabelPaint(java.awt.Paint paint)
Sets the paint used to draw tick labels (if they are showing) and
sends an
AxisChangeEvent to all registered listeners. |
void |
setTickLabelsVisible(boolean flag)
Sets the flag that determines whether or not the tick labels are
visible and sends an
AxisChangeEvent to all registered
listeners. |
void |
setTickMarkInsideLength(float length)
Sets the inside length of the tick marks and sends
an
AxisChangeEvent to all registered listeners. |
void |
setTickMarkOutsideLength(float length)
Sets the outside length of the tick marks and sends
an
AxisChangeEvent to all registered listeners. |
void |
setTickMarkPaint(java.awt.Paint paint)
Sets the paint used to draw tick marks and sends an
AxisChangeEvent to all registered listeners. |
void |
setTickMarkStroke(java.awt.Stroke stroke)
Sets the stroke used to draw tick marks and sends
an
AxisChangeEvent to all registered listeners. |
void |
setTickMarksVisible(boolean flag)
Sets the flag that indicates whether or not the tick marks are showing
and sends an
AxisChangeEvent to all registered listeners. |
void |
setVisible(boolean flag)
Sets a flag that controls whether or not the axis is visible and sends
an
AxisChangeEvent to all registered listeners. |
public static final boolean DEFAULT_AXIS_VISIBLE
public static final java.awt.Font DEFAULT_AXIS_LABEL_FONT
public static final java.awt.Paint DEFAULT_AXIS_LABEL_PAINT
public static final org.jfree.ui.RectangleInsets DEFAULT_AXIS_LABEL_INSETS
public static final java.awt.Paint DEFAULT_AXIS_LINE_PAINT
public static final java.awt.Stroke DEFAULT_AXIS_LINE_STROKE
public static final boolean DEFAULT_TICK_LABELS_VISIBLE
public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
public static final java.awt.Paint DEFAULT_TICK_LABEL_PAINT
public static final org.jfree.ui.RectangleInsets DEFAULT_TICK_LABEL_INSETS
public static final boolean DEFAULT_TICK_MARKS_VISIBLE
public static final java.awt.Stroke DEFAULT_TICK_MARK_STROKE
public static final java.awt.Paint DEFAULT_TICK_MARK_PAINT
public static final float DEFAULT_TICK_MARK_INSIDE_LENGTH
public static final float DEFAULT_TICK_MARK_OUTSIDE_LENGTH
protected Axis(java.lang.String label)
label
- the axis label (null
permitted).public boolean isVisible()
true
if the axis is visible, and
false
otherwise.setVisible(boolean)
public void setVisible(boolean flag)
AxisChangeEvent
to all registered listeners.flag
- the flag.isVisible()
public java.lang.String getLabel()
null
possible).getLabelFont()
,
getLabelPaint()
,
setLabel(String)
public void setLabel(java.lang.String label)
AxisChangeEvent
to all
registered listeners.label
- the new label (null
permitted).getLabel()
,
setLabelFont(Font)
,
setLabelPaint(Paint)
public java.awt.Font getLabelFont()
null
).setLabelFont(Font)
public void setLabelFont(java.awt.Font font)
AxisChangeEvent
to all registered listeners.font
- the font (null
not permitted).getLabelFont()
public java.awt.Paint getLabelPaint()
null
).setLabelPaint(Paint)
public void setLabelPaint(java.awt.Paint paint)
AxisChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getLabelPaint()
public org.jfree.ui.RectangleInsets getLabelInsets()
null
).setLabelInsets(RectangleInsets)
public void setLabelInsets(org.jfree.ui.RectangleInsets insets)
AxisChangeEvent
to all registered listeners.insets
- the insets (null
not permitted).getLabelInsets()
public void setLabelInsets(org.jfree.ui.RectangleInsets insets, boolean notify)
AxisChangeEvent
to all registered listeners.insets
- the insets (null
not permitted).notify
- notify listeners?public double getLabelAngle()
setLabelAngle(double)
public void setLabelAngle(double angle)
AxisChangeEvent
to all
registered listeners.angle
- the angle (in radians).getLabelAngle()
public boolean isAxisLineVisible()
getAxisLinePaint()
,
getAxisLineStroke()
,
setAxisLineVisible(boolean)
public void setAxisLineVisible(boolean visible)
AxisChangeEvent
to all registered listeners.visible
- the flag.isAxisLineVisible()
,
setAxisLinePaint(Paint)
,
setAxisLineStroke(Stroke)
public java.awt.Paint getAxisLinePaint()
null
).setAxisLinePaint(Paint)
public void setAxisLinePaint(java.awt.Paint paint)
AxisChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getAxisLinePaint()
public java.awt.Stroke getAxisLineStroke()
null
).setAxisLineStroke(Stroke)
public void setAxisLineStroke(java.awt.Stroke stroke)
AxisChangeEvent
to all registered listeners.stroke
- the stroke (null
not permitted).getAxisLineStroke()
public boolean isTickLabelsVisible()
getTickLabelFont()
,
getTickLabelPaint()
,
setTickLabelsVisible(boolean)
public void setTickLabelsVisible(boolean flag)
AxisChangeEvent
to all registered
listeners.flag
- the flag.isTickLabelsVisible()
,
setTickLabelFont(Font)
,
setTickLabelPaint(Paint)
public boolean isMinorTickMarksVisible()
setMinorTickMarksVisible(boolean)
public void setMinorTickMarksVisible(boolean flag)
AxisChangeEvent
to all registered
listeners.flag
- the flag.isMinorTickMarksVisible()
public java.awt.Font getTickLabelFont()
null
).setTickLabelFont(Font)
public void setTickLabelFont(java.awt.Font font)
AxisChangeEvent
to all registered listeners.font
- the font (null
not allowed).getTickLabelFont()
public java.awt.Paint getTickLabelPaint()
setTickLabelPaint(Paint)
public void setTickLabelPaint(java.awt.Paint paint)
AxisChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getTickLabelPaint()
public org.jfree.ui.RectangleInsets getTickLabelInsets()
null
).setTickLabelInsets(RectangleInsets)
public void setTickLabelInsets(org.jfree.ui.RectangleInsets insets)
AxisChangeEvent
to all registered listeners.insets
- the insets (null
not permitted).getTickLabelInsets()
public boolean isTickMarksVisible()
setTickMarksVisible(boolean)
public void setTickMarksVisible(boolean flag)
AxisChangeEvent
to all registered listeners.flag
- the flag.isTickMarksVisible()
public float getTickMarkInsideLength()
getTickMarkOutsideLength()
,
setTickMarkInsideLength(float)
public void setTickMarkInsideLength(float length)
AxisChangeEvent
to all registered listeners.length
- the new length.getTickMarkInsideLength()
public float getTickMarkOutsideLength()
getTickMarkInsideLength()
,
setTickMarkOutsideLength(float)
public void setTickMarkOutsideLength(float length)
AxisChangeEvent
to all registered listeners.length
- the new length.getTickMarkInsideLength()
public java.awt.Stroke getTickMarkStroke()
null
).setTickMarkStroke(Stroke)
public void setTickMarkStroke(java.awt.Stroke stroke)
AxisChangeEvent
to all registered listeners.stroke
- the stroke (null
not permitted).getTickMarkStroke()
public java.awt.Paint getTickMarkPaint()
null
).setTickMarkPaint(Paint)
public void setTickMarkPaint(java.awt.Paint paint)
AxisChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getTickMarkPaint()
public float getMinorTickMarkInsideLength()
getMinorTickMarkOutsideLength()
,
setMinorTickMarkInsideLength(float)
public void setMinorTickMarkInsideLength(float length)
AxisChangeEvent
to all registered listeners.length
- the new length.getMinorTickMarkInsideLength()
public float getMinorTickMarkOutsideLength()
getMinorTickMarkInsideLength()
,
setMinorTickMarkOutsideLength(float)
public void setMinorTickMarkOutsideLength(float length)
AxisChangeEvent
to all registered listeners.length
- the new length.getMinorTickMarkInsideLength()
public Plot getPlot()
null
if the axis is not currently assigned to a plot.null
).setPlot(Plot)
public void setPlot(Plot plot)
This method is used internally, you shouldn't need to call it yourself.
plot
- the plot.getPlot()
public double getFixedDimension()
setFixedDimension(double)
public void setFixedDimension(double dimension)
This is used when combining more than one plot on a chart. In this case, there may be several axes that need to have the same height or width so that they are aligned. This method is used to fix a dimension for the axis (the context determines whether the dimension is horizontal or vertical).
dimension
- the fixed dimension.getFixedDimension()
public abstract void configure()
public abstract AxisSpace reserveSpace(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
g2
- 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 abstract 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)
g2
- 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
).public abstract java.util.List refreshTicks(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 area inside the axes.edge
- the edge on which the axis is located.protected void createAndAddEntity(double cursor, AxisState state, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)
cursor
- the initial cursor value.state
- the axis state after completion of the drawing with a
possibly updated cursor position.dataArea
- the data area.edge
- the edge.plotState
- the PlotRenderingInfo from which a reference to the
entity collection can be obtained.public void addChangeListener(AxisChangeListener listener)
listener
- the object that is being registered.removeChangeListener(AxisChangeListener)
public void removeChangeListener(AxisChangeListener listener)
listener
- the object to deregister.addChangeListener(AxisChangeListener)
public boolean hasListener(java.util.EventListener listener)
true
if the specified object is registered with
the dataset as a listener. Most applications won't need to call this
method, it exists mainly for use by unit testing code.listener
- the listener.protected void notifyListeners(AxisChangeEvent event)
event
- information about the change to the axis.protected void fireChangeEvent()
AxisChangeEvent
to all registered listeners.protected java.awt.geom.Rectangle2D getLabelEnclosure(java.awt.Graphics2D g2, org.jfree.ui.RectangleEdge edge)
g2
- the graphics device.edge
- the edge of the plot area along which the axis is measuring.protected AxisState drawLabel(java.lang.String label, java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisState state)
label
- the label text.g2
- the graphics device.plotArea
- the plot area.dataArea
- the area inside the axes.edge
- the location of the axis.state
- the axis state (null
not permitted).protected void drawAxisLine(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
g2
- the graphics device.cursor
- the cursor position.dataArea
- the data area.edge
- the edge.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if some component of the axis does
not support cloning.public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object (null
permitted).true
or false
.public Range getExtents()
public void setExtents(Range range)