public abstract class AbstractAxis3D extends java.lang.Object implements Axis3D, MarkerChangeListener, java.io.Serializable
Axis3D implementation.
This class implements the core axis attributes as well as the change
listener mechanism required to enable automatic repainting of charts.
| Modifier and Type | Field and Description |
|---|---|
static java.awt.Color |
DEFAULT_LABEL_COLOR
The default axis label color (in most circumstances this will be
overridden by the chart style).
|
static java.awt.Font |
DEFAULT_LABEL_FONT
The default axis label font (in most circumstances this will be
overridden by the chart style).
|
static double |
DEFAULT_LABEL_OFFSET
The default label offset.
|
static java.awt.Color |
DEFAULT_LINE_COLOR
The default color for the axis line.
|
static java.awt.Stroke |
DEFAULT_LINE_STROKE
The default stroke for the axis line.
|
static java.awt.Color |
DEFAULT_TICK_LABEL_COLOR
The default tick label color (in most circumstances this will be
overridden by the chart style).
|
static java.awt.Font |
DEFAULT_TICK_LABEL_FONT
The default tick label font (in most circumstances this will be
overridden by the chart style).
|
| Constructor and Description |
|---|
AbstractAxis3D(java.lang.String label)
Creates a new label with the specified label.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addChangeListener(Axis3DChangeListener listener)
Registers a listener so that it will receive axis change events.
|
protected abstract java.lang.String |
axisStr()
Returns a string representing the configured type of the axis ("row",
"column", "value", "x", "y" or "z" - other values may be possible in the
future).
|
abstract void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Point2D startPt,
java.awt.geom.Point2D endPt,
java.awt.geom.Point2D opposingPt,
java.util.List<TickData> tickData,
RenderingInfo info,
boolean hinting)
Draws the axis along an arbitrary line (between
startPt
and endPt). |
protected java.awt.Shape |
drawAxisLabel(java.lang.String label,
java.awt.Graphics2D g2,
java.awt.geom.Line2D axisLine,
java.awt.geom.Point2D opposingPt,
double offset,
RenderingInfo info,
boolean hinting)
Draws the specified text as the axis label and returns a bounding
shape (2D) for the text.
|
boolean |
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.
|
protected void |
fireChangeEvent(boolean requiresWorldUpdate)
Sends an
Axis3DChangeEvent to all registered listeners. |
java.lang.String |
getLabel()
Returns the axis label - the text that describes what the axis measures.
|
java.awt.Color |
getLabelColor()
Returns the color used for the label.
|
java.awt.Font |
getLabelFont()
Returns the font used to display the main axis label.
|
double |
getLabelOffset()
Returns the offset between the tick labels and the axis label, measured
in Java2D units.
|
java.awt.Color |
getLineColor()
Returns the color used to draw the axis line.
|
java.awt.Stroke |
getLineStroke()
Returns the stroke used to draw the axis line.
|
java.awt.Color |
getTickLabelColor()
Returns the foreground color for the tick labels.
|
java.awt.Font |
getTickLabelFont()
Returns the font used to display the tick labels.
|
boolean |
getTickLabelsVisible()
Returns the flag that controls whether or not the tick labels are
drawn.
|
int |
hashCode()
Returns a hash code for this instance.
|
boolean |
isVisible()
Returns the flag that determines whether or not the axis is drawn
on the chart.
|
void |
markerChanged(MarkerChangeEvent event)
Receives notification of a change to a marker managed by this axis - the
response is to fire a change event for the axis (to eventually trigger
a repaint of the chart).
|
void |
notifyListeners(Axis3DChangeEvent event)
Notifies all registered listeners that the plot has been modified.
|
abstract void |
receive(ChartElementVisitor visitor)
Receives a
ChartElementVisitor. |
void |
removeChangeListener(Axis3DChangeListener listener)
Deregisters a listener so that it will no longer receive axis
change events.
|
void |
setLabel(java.lang.String label)
Sets the axis label and sends an
Axis3DChangeEvent to all
registered listeners. |
void |
setLabelColor(java.awt.Color color)
Sets the color used to draw the axis label and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setLabelFont(java.awt.Font font)
Sets the font used to display the main axis label and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setLabelOffset(double offset)
Sets the offset between the tick labels and the axis label and sends
an
Axis3DChangeEvent to all registered listeners. |
void |
setLineColor(java.awt.Color color)
Sets the color used to draw the axis line and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setLineStroke(java.awt.Stroke stroke)
Sets the stroke used to draw the axis line and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setTickLabelColor(java.awt.Color color)
Sets the foreground color for the tick labels and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setTickLabelFont(java.awt.Font font)
Sets the font used to display tick labels and sends an
Axis3DChangeEvent to all registered listeners. |
void |
setTickLabelsVisible(boolean visible)
Sets the flag that controls whether or not the tick labels are drawn,
and sends a change event to all registered listeners.
|
void |
setVisible(boolean visible)
Sets the flag that determines whether or not the axis is drawn on the
chart and sends an
Axis3DChangeEvent to all registered listeners. |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitgetRange, isInverted, setInverted, setRange, setRange, translateToWorldpublic static final java.awt.Font DEFAULT_LABEL_FONT
public static final java.awt.Color DEFAULT_LABEL_COLOR
public static final double DEFAULT_LABEL_OFFSET
public static final java.awt.Font DEFAULT_TICK_LABEL_FONT
public static final java.awt.Color DEFAULT_TICK_LABEL_COLOR
public static final java.awt.Stroke DEFAULT_LINE_STROKE
public static final java.awt.Color DEFAULT_LINE_COLOR
public AbstractAxis3D(java.lang.String label)
null, the axis will be shown without a label.label - the axis label (null permitted).public boolean isVisible()
isVisible in interface Axis3DsetVisible(boolean)public void setVisible(boolean visible)
Axis3DChangeEvent to all registered listeners.setVisible in interface Axis3Dvisible - the flag.isVisible()public java.lang.String getLabel()
null, the axis is drawn without a label.null).public void setLabel(java.lang.String label)
Axis3DChangeEvent to all
registered listeners. If the supplied label is null,
the axis will be drawn without a label.label - the label (null permitted).public java.awt.Font getLabelFont()
Font("SansSerif", Font.BOLD, 12).getLabelFont in interface Axis3Dnull).public void setLabelFont(java.awt.Font font)
Axis3DChangeEvent to all registered listeners.setLabelFont in interface Axis3Dfont - the new font (null not permitted).public java.awt.Color getLabelColor()
Color.BLACK.getLabelColor in interface Axis3Dnull).public void setLabelColor(java.awt.Color color)
Axis3DChangeEvent to all registered listeners.setLabelColor in interface Axis3Dcolor - the color (null not permitted).public double getLabelOffset()
DEFAULT_LABEL_OFFSET.public void setLabelOffset(double offset)
Axis3DChangeEvent to all registered listeners.offset - the offset.public java.awt.Stroke getLineStroke()
DEFAULT_LINE_STROKE.null).public void setLineStroke(java.awt.Stroke stroke)
Axis3DChangeEvent to all registered listeners.stroke - the new stroke (null not permitted).public java.awt.Color getLineColor()
DEFAULT_LINE_COLOR.null).public void setLineColor(java.awt.Color color)
Axis3DChangeEvent to all registered listeners.color - the new color (null not permitted).public boolean getTickLabelsVisible()
true.public void setTickLabelsVisible(boolean visible)
false, because if
the tick labels are not shown it will be hard for the reader to
understand the resulting chart.visible - visible?public java.awt.Font getTickLabelFont()
DEFAULT_TICK_LABEL_FONT.getTickLabelFont in interface Axis3Dnull).public void setTickLabelFont(java.awt.Font font)
Axis3DChangeEvent to all registered listeners.setTickLabelFont in interface Axis3Dfont - the font (null not permitted).public java.awt.Color getTickLabelColor()
DEFAULT_LABEL_COLOR.getTickLabelColor in interface Axis3Dnull).public void setTickLabelColor(java.awt.Color color)
Axis3DChangeEvent to all registered listeners.setTickLabelColor in interface Axis3Dcolor - the color (null not permitted).public abstract void receive(ChartElementVisitor visitor)
ChartElementVisitor. This method is part of a general
mechanism for traversing the chart structure and performing operations
on each element in the chart. You will not normally call this method
directly.receive in interface ChartElementvisitor - the visitor (null not permitted).protected java.awt.Shape drawAxisLabel(java.lang.String label, java.awt.Graphics2D g2, java.awt.geom.Line2D axisLine, java.awt.geom.Point2D opposingPt, double offset, RenderingInfo info, boolean hinting)
label - the label (null not permitted).g2 - the graphics target (null not permitted).axisLine - the axis line (null not permitted).opposingPt - an opposing point (null not permitted).offset - the offset.info - collects rendering info (null permitted).hinting - perform element hinting?protected abstract java.lang.String axisStr()
CategoryPlot3D is in the
position of a z-axis (depth), a column axis is in the position
of an x-axis (width), a value axis is in the position of a
y-axis (height).null).public abstract void draw(java.awt.Graphics2D g2, java.awt.geom.Point2D startPt, java.awt.geom.Point2D endPt, java.awt.geom.Point2D opposingPt, java.util.List<TickData> tickData, RenderingInfo info, boolean hinting)
startPt
and endPt). The opposing point is used as a reference
point to know on which side of the axis to draw the labels.draw in interface Axis3Dg2 - the graphics target (null not permitted).startPt - the starting point (null not permitted).endPt - the end point (null not permitted)opposingPt - an opposing point (null not permitted).tickData - info about the ticks to draw (null not
permitted).info - an object to be populated with rendering info
(null permitted).hinting - a flag that controls whether or not element hinting
should be performed.public boolean equals(java.lang.Object obj)
equals in class java.lang.Objectobj - the object to test against (null permitted).public int hashCode()
hashCode in class java.lang.Objectpublic void addChangeListener(Axis3DChangeListener listener)
addChangeListener in interface Axis3Dlistener - the listener (null not permitted).public void removeChangeListener(Axis3DChangeListener listener)
removeChangeListener in interface Axis3Dlistener - the listener (null not permitted).public void notifyListeners(Axis3DChangeEvent event)
event - information about the change event.protected void fireChangeEvent(boolean requiresWorldUpdate)
Axis3DChangeEvent to all registered listeners.requiresWorldUpdate - a flag indicating whether or not this change
requires the 3D world to be updated.public void markerChanged(MarkerChangeEvent event)
markerChanged in interface MarkerChangeListenerevent - the event.