java.lang.Object
org.jfree.chart3d.axis.AbstractAxis3D
org.jfree.chart3d.axis.AbstractValueAxis3D
org.jfree.chart3d.axis.NumberAxis3D
- All Implemented Interfaces:
Serializable
,EventListener
,Axis3D
,ValueAxis3D
,ChartElement
,MarkerChangeListener
public class NumberAxis3D extends AbstractValueAxis3D implements ValueAxis3D, Serializable
A numerical axis for use with 3D plots (implements
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.
ValueAxis3D
).
In a CategoryPlot3D
the value axis (the vertical one) is numerical,
and in an XYZPlot
all the axes (x, y and z) are numerical - for
all these cases an instance of this class can be used.
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:
- Serialized Form
-
Field Summary
Fields inherited from class org.jfree.chart3d.axis.AbstractValueAxis3D
range
Fields inherited from class org.jfree.chart3d.axis.AbstractAxis3D
DEFAULT_LABEL_COLOR, DEFAULT_LABEL_FONT, DEFAULT_LABEL_OFFSET, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_TICK_LABEL_COLOR, DEFAULT_TICK_LABEL_FONT
-
Constructor Summary
Constructors Constructor Description NumberAxis3D(String label)
Creates a new axis with the specified label and default attributes.NumberAxis3D(String label, Range range)
Creates a new axis with the specified label and range. -
Method Summary
Modifier and Type Method Description protected Range
adjustedDataRange(Range range)
Adjusts the range by adding the lower and upper margins and taking into account also theautoRangeStickyZero
flag.void
draw(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting)
Draws the axis to the supplied graphics target (g2
, with the specified starting and ending points for the line.boolean
equals(Object obj)
Tests this instance for equality with an arbitrary object.List<TickData>
generateTickData(double tickUnit)
Generates a list of tick data items for the specified tick unit.boolean
getAutoRangeIncludesZero()
Returns the flag that determines whether or not the auto range mechanism should force zero to be included in the range.boolean
getAutoRangeStickyZero()
Returns the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins.Format
getTickLabelFormatter()
Returns the tick label formatter.TickSelector
getTickSelector()
Returns the tick selector, an object that is responsible for choosing standard tick units for the axis.double
getTickSize()
Returns the tick size (to be used when the tick selector isnull
).int
hashCode()
Returns a hash code for this instance.double
selectTick(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt)
Selects a tick size that is appropriate for drawing the axis frompt0
topt1
.void
setAutoRangeIncludeZero(boolean include)
Sets the flag that controls whether or not the auto range mechanism should force zero to be included in the axis range, and sends anAxis3DChangeEvent
to all registered listeners.void
setAutoRangeStickyZero(boolean sticky)
Sets the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins.void
setTickLabelFormatter(Format formatter)
Sets the formatter for the tick labels and sends anAxis3DChangeEvent
to all registered listeners.void
setTickSelector(TickSelector selector)
Sets the tick selector and sends anAxis3DChangeEvent
to all registered listeners.void
setTickSize(double tickSize)
Sets the tick size and sends anAxis3DChangeEvent
to all registered listeners.double
translateToWorld(double value, double length)
Converts a data value to world coordinates, taking into account the current axis range (assumes the world axis is zero-based and has the specified length).Methods inherited from class org.jfree.chart3d.axis.AbstractValueAxis3D
axisStr, configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getDefaultAutoRange, getLowerMargin, getMarker, getMarkers, getMinAutoRangeLength, getRange, getTickLabelFactor, getTickLabelOffset, getTickLabelOrientation, getTickMarkLength, getTickMarkPaint, getTickMarkStroke, getUpperMargin, isAutoAdjustRange, isInverted, receive, setAutoAdjustRange, setDefaultAutoRange, setInverted, setLowerMargin, setMarker, setMinAutoRangeLength, setRange, setRange, setTickLabelFactor, setTickLabelOffset, setTickLabelOrientation, setTickMarkLength, setTickMarkPaint, setTickMarkStroke, setUpperMargin, updateRange
Methods inherited from class org.jfree.chart3d.axis.AbstractAxis3D
addChangeListener, drawAxisLabel, fireChangeEvent, getLabel, getLabelColor, getLabelFont, getLabelOffset, getLineColor, getLineStroke, getTickLabelColor, getTickLabelFont, getTickLabelsVisible, isVisible, markerChanged, notifyListeners, removeChangeListener, setLabel, setLabelColor, setLabelFont, setLabelOffset, setLineColor, setLineStroke, setTickLabelColor, setTickLabelFont, setTickLabelsVisible, setVisible
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
addChangeListener, getLabelColor, getLabelFont, getRange, getTickLabelColor, getTickLabelFont, isInverted, isVisible, removeChangeListener, setInverted, setLabelColor, setLabelFont, setRange, setRange, setTickLabelColor, setTickLabelFont, setVisible
Methods inherited from interface org.jfree.chart3d.ChartElement
receive
Methods inherited from interface org.jfree.chart3d.axis.ValueAxis3D
configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getMarker
-
Constructor Details
-
NumberAxis3D
Creates a new axis with the specified label and default attributes.- Parameters:
label
- the axis label (null
permitted).
-
NumberAxis3D
Creates a new axis with the specified label and range.- Parameters:
label
- the axis label (null
permitted).range
- the range (null
not permitted).
-
-
Method Details
-
getAutoRangeIncludesZero
Returns the flag that determines whether or not the auto range mechanism should force zero to be included in the range. The default value isfalse
.- Returns:
- A boolean.
-
setAutoRangeIncludeZero
Sets the flag that controls whether or not the auto range mechanism should force zero to be included in the axis range, and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
include
- the new flag value.
-
getAutoRangeStickyZero
Returns the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins. The default value istrue
.- Returns:
- A boolean.
- See Also:
setAutoRangeStickyZero(boolean)
-
setAutoRangeStickyZero
Sets the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins. Iftrue
, when zero is in the axis margin the axis range is truncated at zero. Iffalse
, there is no special treatment.- Parameters:
sticky
- the new flag value.
-
getTickSelector
Returns the tick selector, an object that is responsible for choosing standard tick units for the axis. The default value is a default instance ofNumberTickSelector
.- Returns:
- The tick selector.
- See Also:
setTickSelector(TickSelector)
-
setTickSelector
Sets the tick selector and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
selector
- the selector (null
permitted).- See Also:
getTickSelector()
-
getTickSize
Returns the tick size (to be used when the tick selector isnull
).- Returns:
- The tick size.
-
setTickSize
Sets the tick size and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
tickSize
- the new tick size.
-
getTickLabelFormatter
Returns the tick label formatter. The default value isDecimalFormat("0.00")
.- Returns:
- The tick label formatter (never
null
).
-
setTickLabelFormatter
Sets the formatter for the tick labels and sends anAxis3DChangeEvent
to all registered listeners.- Parameters:
formatter
- the formatter (null
not permitted).
-
adjustedDataRange
Adjusts the range by adding the lower and upper margins and taking into account also theautoRangeStickyZero
flag.- Specified by:
adjustedDataRange
in classAbstractValueAxis3D
- Parameters:
range
- the range (null
not permitted).- Returns:
- The adjusted range.
-
draw
public void draw(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting)Draws the axis to the supplied graphics target (g2
, with the specified starting and ending points for the line. This method is used internally, you should not need to call it directly.- Specified by:
draw
in interfaceAxis3D
- Specified by:
draw
in classAbstractAxis3D
- Parameters:
g2
- the graphics target (null
not permitted).pt0
- the starting point (null
not permitted).pt1
- the ending point (null
not permitted).opposingPt
- an opposing point (to determine which side of the axis line the labels should appear,null
not permitted).tickData
- tick details (null
not permitted).info
- an object to be populated with rendering info (null
permitted).hinting
- perform element hinting?
-
translateToWorld
Converts a data value to world coordinates, taking into account the current axis range (assumes the world axis is zero-based and has the specified length).- Specified by:
translateToWorld
in interfaceAxis3D
- Parameters:
value
- the data value (in axis units).length
- the length of the (zero based) world axis.- Returns:
- A world coordinate.
-
selectTick
Selects a tick size that is appropriate for drawing the axis frompt0
topt1
.- Specified by:
selectTick
in interfaceValueAxis3D
- Parameters:
g2
- the graphics target (null
not permitted).pt0
- the starting point for the axis.pt1
- the ending point for the axis.opposingPt
- a point on the opposite side of the line from where the labels should be drawn.- Returns:
- The tick size.
-
generateTickData
Generates a list of tick data items for the specified tick unit. This data will be passed to the 3D engine and will be updated with a 2D projection that can later be used to write the axis tick labels in the appropriate places.
IftickUnit
isDouble.NaN
, then tick data is generated for just the bounds of the axis.- Specified by:
generateTickData
in interfaceValueAxis3D
- Parameters:
tickUnit
- the tick unit.- Returns:
- A list of tick data (never
null
).
-
equals
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classAbstractValueAxis3D
- Parameters:
obj
- the object to test against (null
permitted).- Returns:
- A boolean.
-
hashCode
Returns a hash code for this instance.- Overrides:
hashCode
in classAbstractAxis3D
- Returns:
- A hash code.
-