org.jfree.chart.axis
public abstract class Axis extends Object implements Cloneable, Serializable
Field Summary | |
---|---|
static Font | DEFAULT_AXIS_LABEL_FONT The default axis label font. |
static RectangleInsets | DEFAULT_AXIS_LABEL_INSETS The default axis label insets. |
static Paint | DEFAULT_AXIS_LABEL_PAINT The default axis label paint. |
static Paint | DEFAULT_AXIS_LINE_PAINT The default axis line paint. |
static Stroke | DEFAULT_AXIS_LINE_STROKE The default axis line stroke. |
static boolean | DEFAULT_AXIS_VISIBLE The default axis visibility. |
static boolean | DEFAULT_TICK_LABELS_VISIBLE The default tick labels visibility. |
static Font | DEFAULT_TICK_LABEL_FONT The default tick label font. |
static RectangleInsets | DEFAULT_TICK_LABEL_INSETS The default tick label insets. |
static Paint | DEFAULT_TICK_LABEL_PAINT The default tick label paint. |
static boolean | DEFAULT_TICK_MARKS_VISIBLE The default tick marks visible. |
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 Paint | DEFAULT_TICK_MARK_PAINT The default tick paint. |
static Stroke | DEFAULT_TICK_MARK_STROKE The default tick stroke. |
Constructor Summary | |
---|---|
protected | Axis(String label)
Constructs an axis, using default values where necessary.
|
Method Summary | |
---|---|
void | addChangeListener(AxisChangeListener listener)
Registers an object for notification of changes to the axis.
|
Object | clone()
Returns a clone of the axis.
|
abstract void | configure()
Configures the axis to work with the current plot. |
abstract 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).
|
protected void | drawAxisLine(Graphics2D g2, double cursor, Rectangle2D dataArea, RectangleEdge edge)
Draws an axis line at the current cursor position and edge.
|
protected AxisState | drawLabel(String label, Graphics2D g2, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge, AxisState state)
Draws the axis label.
|
boolean | equals(Object obj)
Tests this axis for equality with another object.
|
Paint | getAxisLinePaint()
Returns the paint used to draw the axis line.
|
Stroke | getAxisLineStroke()
Returns the stroke used to draw the axis line.
|
double | getFixedDimension()
Returns the fixed dimension for the axis.
|
String | getLabel()
Returns the label for the axis.
|
double | getLabelAngle()
Returns the angle of the axis label.
|
protected Rectangle2D | getLabelEnclosure(Graphics2D g2, RectangleEdge edge)
Returns a rectangle that encloses the axis label. |
Font | getLabelFont()
Returns the font for the axis label.
|
RectangleInsets | getLabelInsets()
Returns the insets for the label (that is, the amount of blank space
that should be left around the label).
|
Paint | getLabelPaint()
Returns the color/shade used to draw the axis label.
|
Plot | getPlot()
Returns the plot that the axis is assigned to. |
Font | getTickLabelFont()
Returns the font used for the tick labels (if showing).
|
RectangleInsets | getTickLabelInsets()
Returns the insets for the tick labels.
|
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.
|
Paint | getTickMarkPaint()
Returns the paint used to draw tick marks (if they are showing).
|
Stroke | getTickMarkStroke()
Returns the stroke used to draw tick marks.
|
boolean | hasListener(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 | 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 List | refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, 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(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space)
Estimates the space (height or width) required to draw the axis.
|
void | setAxisLinePaint(Paint paint)
Sets the paint used to draw the axis line and sends an
AxisChangeEvent to all registered listeners.
|
void | setAxisLineStroke(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 | setFixedDimension(double dimension)
Sets the fixed dimension for the axis.
|
void | setLabel(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(Font font)
Sets the font for the axis label and sends an AxisChangeEvent
to all registered listeners.
|
void | setLabelInsets(RectangleInsets insets)
Sets the insets for the axis label, and sends an AxisChangeEvent
to all registered listeners.
|
void | setLabelPaint(Paint paint)
Sets the paint used to draw the axis label 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(Font font)
Sets the font for the tick labels and sends an AxisChangeEvent
to all registered listeners.
|
void | setTickLabelInsets(RectangleInsets insets)
Sets the insets for the tick labels and sends an AxisChangeEvent
to all registered listeners.
|
void | setTickLabelPaint(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(Paint paint)
Sets the paint 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 | setTickMarkStroke(Stroke stroke)
Sets the stroke used to draw tick marks 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.
|
Parameters: label the axis label (null
permitted).
Parameters: listener the object that is being registered.
See Also: removeChangeListener
Returns: A clone.
Throws: CloneNotSupportedException if some component of the axis does not support cloning.
Parameters: 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).
Returns: The axis state (never null
).
Parameters: g2 the graphics device. cursor the cursor position. dataArea the data area. edge the edge.
Parameters: 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).
Returns: Information about the axis.
Parameters: obj the object (null
permitted).
Returns: true
or false
.
Returns: The paint (never null
).
See Also: setAxisLinePaint
Returns: The stroke (never null
).
See Also: setAxisLineStroke
Returns: The fixed dimension.
See Also: Axis
Returns: The label for the axis (null
possible).
See Also: getLabelFont getLabelPaint setLabel
Returns: The angle (in radians).
See Also: Axis
Parameters: g2 the graphics device. edge the edge of the plot area along which the axis is measuring.
Returns: The enclosing rectangle.
Returns: The font (never null
).
See Also: setLabelFont
Returns: The label insets (never null
).
See Also: setLabelInsets
Returns: The paint (never null
).
See Also: setLabelPaint
null
if the axis is not currently assigned to a plot.
Returns: The plot that the axis is assigned to (possibly
null
).
See Also: setPlot
Returns: The font (never null
).
See Also: setTickLabelFont
Returns: The insets (never null
).
See Also: setTickLabelInsets
Returns: The paint used for the tick labels.
See Also: setTickLabelPaint
Returns: The length.
See Also: getTickMarkOutsideLength Axis
Returns: The length.
See Also: getTickMarkInsideLength Axis
Returns: The paint (never null
).
See Also: setTickMarkPaint
Returns: The stroke (never null
).
See Also: setTickMarkStroke
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.
Parameters: listener the listener.
Returns: A boolean.
Returns: A boolean.
See Also: getAxisLinePaint getAxisLineStroke Axis
Returns: The flag.
See Also: getTickLabelFont getTickLabelPaint Axis
Returns: The flag that indicates whether or not the tick marks are showing.
See Also: Axis
Parameters: event information about the change to the axis.
Parameters: g2 the graphics device. state the axis state. dataArea the area inside the axes. edge the edge on which the axis is located.
Returns: The list of ticks.
Parameters: listener the object to deregister.
See Also: addChangeListener
Parameters: 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.
Returns: The space required to draw the axis (including pre-reserved space).
Parameters: paint the paint (null
not permitted).
See Also: getAxisLinePaint
Parameters: stroke the stroke (null
not permitted).
See Also: getAxisLineStroke
Parameters: visible the flag.
See Also: isAxisLineVisible setAxisLinePaint setAxisLineStroke
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).
Parameters: dimension the fixed dimension.
See Also: getFixedDimension
Parameters: label the new label (null
permitted).
See Also: getLabel setLabelFont setLabelPaint
Parameters: angle the angle (in radians).
See Also: getLabelAngle
Parameters: font the font (null
not permitted).
See Also: getLabelFont
Parameters: insets the insets (null
not permitted).
See Also: getLabelInsets
Parameters: paint the paint (null
not permitted).
See Also: getLabelPaint
This method is used internally, you shouldn't need to call it yourself.
Parameters: plot the plot.
See Also: getPlot
Parameters: font the font (null
not allowed).
See Also: getTickLabelFont
Parameters: insets the insets (null
not permitted).
See Also: getTickLabelInsets
Parameters: paint the paint (null
not permitted).
See Also: getTickLabelPaint
Parameters: flag the flag.
See Also: isTickLabelsVisible setTickLabelFont setTickLabelPaint
Parameters: length the new length.
See Also: getTickMarkInsideLength
Parameters: length the new length.
See Also: getTickMarkInsideLength
Parameters: paint the paint (null
not permitted).
See Also: getTickMarkPaint
Parameters: flag the flag.
See Also: isTickMarksVisible
Parameters: stroke the stroke (null
not permitted).
See Also: getTickMarkStroke
Parameters: flag the flag.
See Also: isVisible