java.lang.Object
org.jfree.chart3d.axis.AbstractAxis3D
- All Implemented Interfaces:
Serializable
,EventListener
,Axis3D
,ChartElement
,MarkerChangeListener
- Direct Known Subclasses:
AbstractValueAxis3D
,StandardCategoryAxis3D
public abstract class AbstractAxis3D
extends Object
implements Axis3D, MarkerChangeListener, Serializable
A base class that can be used to create an
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
Axis3D
implementation.
This class implements the core axis attributes as well as the change
listener mechanism required to enable automatic repainting of charts.
NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Color
The default axis label color (in most circumstances this will be overridden by the chart style).static final Font
The default axis label font (in most circumstances this will be overridden by the chart style).static final double
The default label offset.static final Color
The default color for the axis line.static final Stroke
The default stroke for the axis line.static final Color
The default tick label color (in most circumstances this will be overridden by the chart style).static final Font
The default tick label font (in most circumstances this will be overridden by the chart style). -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
addChangeListener
(Axis3DChangeListener listener) Registers a listener so that it will receive axis change events.protected abstract 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
(Graphics2D g2, Point2D startPt, Point2D endPt, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting) Draws the axis along an arbitrary line (betweenstartPt
andendPt
).protected Shape
drawAxisLabel
(String label, Graphics2D g2, Line2D axisLine, 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
Tests this instance for equality with an arbitrary object.protected void
fireChangeEvent
(boolean requiresWorldUpdate) Sends anAxis3DChangeEvent
to all registered listeners.getLabel()
Returns the axis label - the text that describes what the axis measures.Returns the color used for the label.Returns the font used to display the main axis label.double
Returns the offset between the tick labels and the axis label, measured in Java2D units.Returns the color used to draw the axis line.Returns the stroke used to draw the axis line.Returns the foreground color for the tick labels.Returns the font used to display the tick labels.boolean
Returns the flag that controls whether or not the tick labels are drawn.int
hashCode()
Returns a hash code for this instance.boolean
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 axis has been modified.abstract void
receive
(ChartElementVisitor visitor) Receives aChartElementVisitor
.void
removeChangeListener
(Axis3DChangeListener listener) Unregisters a listener so that it will no longer receive axis change events.void
Sets the axis label and sends anAxis3DChangeEvent
to all registered listeners.void
setLabelColor
(Color color) Sets the color used to draw the axis label and sends anAxis3DChangeEvent
to all registered listeners.void
setLabelFont
(Font font) Sets the font used to display the main axis label and sends anAxis3DChangeEvent
to all registered listeners.void
setLabelOffset
(double offset) Sets the offset between the tick labels and the axis label and sends anAxis3DChangeEvent
to all registered listeners.void
setLineColor
(Color color) Sets the color used to draw the axis line and sends anAxis3DChangeEvent
to all registered listeners.void
setLineStroke
(Stroke stroke) Sets the stroke used to draw the axis line and sends anAxis3DChangeEvent
to all registered listeners.void
setTickLabelColor
(Color color) Sets the foreground color for the tick labels and sends anAxis3DChangeEvent
to all registered listeners.void
setTickLabelFont
(Font font) Sets the font used to display tick labels and sends anAxis3DChangeEvent
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 anAxis3DChangeEvent
to all registered listeners.Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.jfree.chart3d.axis.Axis3D
getRange, isInverted, setInverted, setRange, setRange, translateToWorld
-
Field Details
-
DEFAULT_LABEL_FONT
The default axis label font (in most circumstances this will be overridden by the chart style).- Since:
- 1.2
-
DEFAULT_LABEL_COLOR
The default axis label color (in most circumstances this will be overridden by the chart style).- Since:
- 1.2
-
DEFAULT_LABEL_OFFSET
The default label offset.- Since:
- 1.2
- See Also:
-
DEFAULT_TICK_LABEL_FONT
The default tick label font (in most circumstances this will be overridden by the chart style).- Since:
- 1.2
-
DEFAULT_TICK_LABEL_COLOR
The default tick label color (in most circumstances this will be overridden by the chart style).- Since:
- 1.2
-
DEFAULT_LINE_STROKE
The default stroke for the axis line.- Since:
- 1.2
-
DEFAULT_LINE_COLOR
The default color for the axis line.- Since:
- 1.2
-
-
Constructor Details
-
AbstractAxis3D
Creates a new label with the specified label. If the supplied label isnull
, the axis will be shown without a label.- Parameters:
label
- the axis label (null
permitted).
-
-
Method Details
-
isVisible
Returns the flag that determines whether or not the axis is drawn on the chart. -
setVisible
Sets the flag that determines whether or not the axis is drawn on the chart and sends anAxis3DChangeEvent
to all registered listeners.- Specified by:
setVisible
in interfaceAxis3D
- Parameters:
visible
- the flag.- See Also:
-
getLabel
Returns the axis label - the text that describes what the axis measures. The description should usually specify the units. When this attribute isnull
, the axis is drawn without a label.- Returns:
- The axis label (possibly
null
).
-
setLabel
Sets the axis label and sends anAxis3DChangeEvent
to all registered listeners. If the supplied label isnull
, the axis will be drawn without a label.- Parameters:
label
- the label (null
permitted).
-
getLabelFont
Returns the font used to display the main axis label. The default value isFont("SansSerif", Font.BOLD, 12)
.- Specified by:
getLabelFont
in interfaceAxis3D
- Returns:
- The font used to display the axis label (never
null
).
-
setLabelFont
Sets the font used to display the main axis label and sends anAxis3DChangeEvent
to all registered listeners.- Specified by:
setLabelFont
in interfaceAxis3D
- Parameters:
font
- the new font (null
not permitted).
-
getLabelColor
Returns the color used for the label. The default value isColor.BLACK
.- Specified by:
getLabelColor
in interfaceAxis3D
- Returns:
- The label paint (never
null
).
-
setLabelColor
Sets the color used to draw the axis label and sends anAxis3DChangeEvent
to all registered listeners.- Specified by:
setLabelColor
in interfaceAxis3D
- Parameters:
color
- the color (null
not permitted).
-
getLabelOffset
Returns the offset between the tick labels and the axis label, measured in Java2D units. The default value isDEFAULT_LABEL_OFFSET
.- Returns:
- The offset.
- Since:
- 1.2
-
setLabelOffset
Sets the offset between the tick labels and the axis label and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
offset
- the offset.- Since:
- 1.2
-
getLineStroke
Returns the stroke used to draw the axis line. The default value isDEFAULT_LINE_STROKE
.- Returns:
- The stroke used to draw the axis line (never
null
).
-
setLineStroke
Sets the stroke used to draw the axis line and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
stroke
- the new stroke (null
not permitted).
-
getLineColor
Returns the color used to draw the axis line. The default value isDEFAULT_LINE_COLOR
.- Returns:
- The color used to draw the axis line (never
null
).
-
setLineColor
Sets the color used to draw the axis line and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
color
- the new color (null
not permitted).
-
getTickLabelsVisible
Returns the flag that controls whether or not the tick labels are drawn. The default value istrue
.- Returns:
- A boolean.
-
setTickLabelsVisible
Sets the flag that controls whether or not the tick labels are drawn, and sends a change event to all registered listeners. You should think carefully before setting this flag tofalse
, because if the tick labels are not shown it will be hard for the reader to understand the resulting chart.- Parameters:
visible
- visible?
-
getTickLabelFont
Returns the font used to display the tick labels. The default value isDEFAULT_TICK_LABEL_FONT
.- Specified by:
getTickLabelFont
in interfaceAxis3D
- Returns:
- The font (never
null
).
-
setTickLabelFont
Sets the font used to display tick labels and sends anAxis3DChangeEvent
to all registered listeners.- Specified by:
setTickLabelFont
in interfaceAxis3D
- Parameters:
font
- the font (null
not permitted).
-
getTickLabelColor
Returns the foreground color for the tick labels. The default value isDEFAULT_LABEL_COLOR
.- Specified by:
getTickLabelColor
in interfaceAxis3D
- Returns:
- The foreground color (never
null
).
-
setTickLabelColor
Sets the foreground color for the tick labels and sends anAxis3DChangeEvent
to all registered listeners.- Specified by:
setTickLabelColor
in interfaceAxis3D
- Parameters:
color
- the color (null
not permitted).
-
receive
Receives aChartElementVisitor
. 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.- Specified by:
receive
in interfaceChartElement
- Parameters:
visitor
- the visitor (null
not permitted).- Since:
- 1.2
-
drawAxisLabel
protected Shape drawAxisLabel(String label, Graphics2D g2, Line2D axisLine, 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.- Parameters:
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?- Returns:
- A bounding shape.
-
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). A row axis on aCategoryPlot3D
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).- Returns:
- A string (never
null
). - Since:
- 1.3
-
draw
public abstract void draw(Graphics2D g2, Point2D startPt, Point2D endPt, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting) Draws the axis along an arbitrary line (betweenstartPt
andendPt
). The opposing point is used as a reference point to know on which side of the axis to draw the labels.- Specified by:
draw
in interfaceAxis3D
- Parameters:
g2
- 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.
-
equals
Tests this instance for equality with an arbitrary object. -
hashCode
Returns a hash code for this instance. -
addChangeListener
Registers a listener so that it will receive axis change events.- Specified by:
addChangeListener
in interfaceAxis3D
- Parameters:
listener
- the listener (null
not permitted).
-
removeChangeListener
Unregisters a listener so that it will no longer receive axis change events.- Specified by:
removeChangeListener
in interfaceAxis3D
- Parameters:
listener
- the listener (null
not permitted).
-
notifyListeners
Notifies all registered listeners that the axis has been modified.- Parameters:
event
- information about the change event.
-
fireChangeEvent
Sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
requiresWorldUpdate
- a flag indicating whether this change requires the 3D world to be updated.
-
markerChanged
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). Marker changes don't require the world model to be updated.- Specified by:
markerChanged
in interfaceMarkerChangeListener
- Parameters:
event
- the event.- Since:
- 1.2
-