java.lang.Object
org.jfree.chart3d.axis.AbstractAxis3D
org.jfree.chart3d.axis.StandardCategoryAxis3D
- All Implemented Interfaces:
Serializable,EventListener,Axis3D,CategoryAxis3D,ChartElement,MarkerChangeListener
An axis that displays categories.
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.
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
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
ConstructorsConstructorDescriptionDefault constructor.StandardCategoryAxis3D(String label) Creates a new axis with the specified label. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringaxisStr()Returns "row" if the axis has been configured as a row axis, "column" if the axis has been configured as a column axis, and the empty string ("") if the axis has not yet been configured.voidConfigures the axis to be used as a column axis for the specified plot.voidConfigures the axis to be used as a row axis for the specified plot.voiddraw(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting) Draws the axis between the two pointspt0andpt1in Java2D space.booleanTests this instance for equality with an arbitrary object.Generates and returns a list of marker data items for the axis.Generates the tick data for the axis (assumes the axis is being used as the row axis).generateTickDataForRows(CategoryDataset3D dataset) Generates the tick data for the axis (assumes the axis is being used as the row axis).doublegetCategoryValue(Comparable<?> category) Returns the value for the specified category, orDouble.NaNif the category is not registered on the axis.doubleReturns the width of a single category in the units of the axis range.doubleReturns the margin to leave at the lower end of the axis, as a percentage of the axis length.Returns the marker with the specified key, if there is one.Returns a new map containing the markers that are assigned to this axis.intReturns the maximum number of offset levels for the category labels on the axis.getRange()Returns the range for the axis.doubleReturns the tick label factor.Returns the tick label generator for the axis.doubleReturns the offset between the tick marks and the tick labels.Returns the orientation for the tick labels.doubleReturns the tick mark length (in Java2D units).Returns the paint used to draw the tick marks, if they are visible.Returns the stroke used to draw the tick marks, if they are visible.doubleReturns the margin to leave at the upper end of the axis, as a percentage of the axis length.booleanReturnstrueif this axis has been configured as a column axis for the plot that it belongs to, andfalseotherwise.booleanReturnstrueif the first category on the axis should occupy half the normal width, andfalseotherwise.booleanReturnstrueif the axis inverts the order of the data items, andfalseotherwise.booleanReturnstrueif the last category on the axis should occupy half the normal width, andfalseotherwise.booleanReturnstrueif this axis has been configured as a row axis for the plot that it belongs to, andfalseotherwise.voidreceive(ChartElementVisitor visitor) Receives aChartElementVisitor.voidsetFirstCategoryHalfWidth(boolean half) Sets the flag that controls whether the first category on the axis occupies a full or half width, and sends anAxis3DChangeEventto all registered listeners.voidsetInverted(boolean inverted) Sets the flag that controls whether or not the axis inverts the order of the data items and sends anAxis3DChangeEventto all registered listeners.voidsetLastCategoryHalfWidth(boolean half) Sets the flag that controls whether the last category on the axis occupies a full or half width, and sends anAxis3DChangeEventto all registered listeners.voidsetLowerMargin(double margin) Sets the margin to leave at the lower end of the axis and sends anAxis3DChangeEventto all registered listeners.voidsetMarker(String key, CategoryMarker marker) Sets the marker for the specified key and sends a change event to all registered listeners.voidsetMaxTickLabelLevels(int levels) Sets the maximum number of offset levels for the category labels on the axis and sends a change event to all registered listeners.voidsetRange(double lowerBound, double upperBound) Sets the range for the axis and sends anAxis3DChangeEventto all registered listeners.voidSets the range for the axis and sends anAxis3DChangeEventto all registered listeners.voidsetTickLabelFactor(double factor) Sets the tick label factor and sends a change event to all registered listeners.voidsetTickLabelGenerator(CategoryLabelGenerator generator) Sets the tick label generator for the axis and sends a change event to all registered listeners.voidsetTickLabelOffset(double offset) Sets the offset between the tick marks and the tick labels and sends aAxis3DChangeEventto all registered listeners.voidsetTickLabelOrientation(LabelOrientation orientation) Sets the orientation for the tick labels and sends a change event to all registered listeners.voidsetTickMarkLength(double length) Sets the tick mark length (in Java2D units) and sends anAxis3DChangeEventto all registered listeners.voidsetTickMarkPaint(Paint paint) Sets the paint used to draw the tick marks and sends anAxis3DChangeEventto all registered listeners.voidsetTickMarkStroke(Stroke stroke) Sets the stroke used to draw the tick marks and sends anAxis3DChangeEventto all registered listeners.voidsetUpperMargin(double margin) Sets the margin to leave at the upper end of the axis and sends anAxis3DChangeEventto all registered listeners.doubletranslateToWorld(double value, double length) Translates a value on the axis to the equivalent coordinate in the 3D world used to construct a model of the chart.Methods inherited from class org.jfree.chart3d.axis.AbstractAxis3D
addChangeListener, drawAxisLabel, fireChangeEvent, getLabel, getLabelColor, getLabelFont, getLabelOffset, getLineColor, getLineStroke, getTickLabelColor, getTickLabelFont, getTickLabelsVisible, hashCode, isVisible, markerChanged, notifyListeners, removeChangeListener, setLabel, setLabelColor, setLabelFont, setLabelOffset, setLineColor, setLineStroke, setTickLabelColor, setTickLabelFont, setTickLabelsVisible, setVisibleMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart3d.axis.Axis3D
addChangeListener, getLabelColor, getLabelFont, getTickLabelColor, getTickLabelFont, isVisible, removeChangeListener, setLabelColor, setLabelFont, setTickLabelColor, setTickLabelFont, setVisible
-
Constructor Details
-
StandardCategoryAxis3D
public StandardCategoryAxis3D()Default constructor. -
StandardCategoryAxis3D
Creates a new axis with the specified label.- Parameters:
label- the axis label (nullpermitted).
-
-
Method Details
-
isRowAxis
Returnstrueif this axis has been configured as a row axis for the plot that it belongs to, andfalseotherwise.- Specified by:
isRowAxisin interfaceCategoryAxis3D- Returns:
- A boolean.
- Since:
- 1.3
-
isColumnAxis
Returnstrueif this axis has been configured as a column axis for the plot that it belongs to, andfalseotherwise.- Specified by:
isColumnAxisin interfaceCategoryAxis3D- Returns:
- A boolean.
- Since:
- 1.3
-
getRange
Returns the range for the axis. By convention, the category axes have a range from 0.0 to 1.0. -
setRange
Sets the range for the axis and sends anAxis3DChangeEventto all registered listeners. -
setRange
Sets the range for the axis and sends anAxis3DChangeEventto all registered listeners. Note that changing the range for the category axis will have no visible effect. -
getLowerMargin
Returns the margin to leave at the lower end of the axis, as a percentage of the axis length. The default is0.05(five percent).- Returns:
- The lower margin.
-
setLowerMargin
Sets the margin to leave at the lower end of the axis and sends anAxis3DChangeEventto all registered listeners.- Parameters:
margin- the margin.
-
getUpperMargin
Returns the margin to leave at the upper end of the axis, as a percentage of the axis length. The default is0.05(five percent).- Returns:
- The lower margin.
-
setUpperMargin
Sets the margin to leave at the upper end of the axis and sends anAxis3DChangeEventto all registered listeners.- Parameters:
margin- the margin.
-
isFirstCategoryHalfWidth
Returnstrueif the first category on the axis should occupy half the normal width, andfalseotherwise.- Returns:
- A boolean.
- See Also:
-
setFirstCategoryHalfWidth
Sets the flag that controls whether the first category on the axis occupies a full or half width, and sends anAxis3DChangeEventto all registered listeners. There are some renderers where the charts look better when half-widths are used (for example,AreaRenderer3D).- Parameters:
half- half width?- See Also:
-
isLastCategoryHalfWidth
Returnstrueif the last category on the axis should occupy half the normal width, andfalseotherwise.- Returns:
- A boolean.
- See Also:
-
setLastCategoryHalfWidth
Sets the flag that controls whether the last category on the axis occupies a full or half width, and sends anAxis3DChangeEventto all registered listeners. There are some renderers where the charts look better when half-widths are used (for example,AreaRenderer3D).- Parameters:
half- half width?- See Also:
-
getTickMarkLength
Returns the tick mark length (in Java2D units). The default value is3.0.- Returns:
- The tick mark length.
-
setTickMarkLength
Sets the tick mark length (in Java2D units) and sends anAxis3DChangeEventto all registered listeners. You can set the length to0.0if you don't want any tick marks on the axis.- Parameters:
length- the length (in Java2D units).
-
getTickMarkPaint
Returns the paint used to draw the tick marks, if they are visible. The default value isColor.GRAY.- Returns:
- The paint used to draw the tick marks (never
null).
-
setTickMarkPaint
Sets the paint used to draw the tick marks and sends anAxis3DChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).
-
getTickMarkStroke
Returns the stroke used to draw the tick marks, if they are visible. The default value isnew BasicStroke(0.5f).- Returns:
- The stroke used to draw the tick marks (never
null).
-
setTickMarkStroke
Sets the stroke used to draw the tick marks and sends anAxis3DChangeEventto all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).
-
getTickLabelGenerator
Returns the tick label generator for the axis. This is an object that is responsible for creating the category labels on the axis. You can plug in your own instance to take full control over the generation of category labels.- Returns:
- The tick label generator for the axis (never
null). - Since:
- 1.2
-
setTickLabelGenerator
Sets the tick label generator for the axis and sends a change event to all registered listeners.- Parameters:
generator- the generator (nullnot permitted).- Since:
- 1.2
-
getTickLabelOffset
Returns the offset between the tick marks and the tick labels. The default value is5.0.- Returns:
- The offset between the tick marks and the tick labels (in Java2D units).
-
setTickLabelOffset
Sets the offset between the tick marks and the tick labels and sends aAxis3DChangeEventto all registered listeners.- Parameters:
offset- the offset.
-
getTickLabelOrientation
Returns the orientation for the tick labels. The default value isLabelOrientation.PARALLEL.- Returns:
- The orientation for the tick labels (never
null). - Since:
- 1.2
-
setTickLabelOrientation
Sets the orientation for the tick labels and sends a change event to all registered listeners.- Parameters:
orientation- the orientation (nullnot permitted).- Since:
- 1.2
-
getMaxTickLabelLevels
Returns the maximum number of offset levels for the category labels on the axis. The default value is 3.- Returns:
- The maximum number of offset levels.
- Since:
- 1.2
-
setMaxTickLabelLevels
Sets the maximum number of offset levels for the category labels on the axis and sends a change event to all registered listeners.- Parameters:
levels- the maximum number of levels.- Since:
- 1.2
-
getTickLabelFactor
Returns the tick label factor. The default value is1.4.- Returns:
- The tick label factor.
- Since:
- 1.2
-
setTickLabelFactor
Sets the tick label factor and sends a change event to all registered listeners.- Parameters:
factor- the new factor (should be at least 1.0).- Since:
- 1.2
-
getMarker
Returns the marker with the specified key, if there is one.- Specified by:
getMarkerin interfaceCategoryAxis3D- Parameters:
key- the key (nullnot permitted).- Returns:
- The marker (possibly
null). - Since:
- 1.2
-
setMarker
Sets the marker for the specified key and sends a change event to all registered listeners. If there is an existing marker it is replaced (and the axis will no longer listen for change events on the previous marker).- Parameters:
key- the key that identifies the marker (nullnot permitted).marker- the marker (nullpermitted).- Since:
- 1.2
-
getMarkers
Returns a new map containing the markers that are assigned to this axis.- Returns:
- A map.
- Since:
- 1.2
-
getCategoryWidth
Returns the width of a single category in the units of the axis range.- Specified by:
getCategoryWidthin interfaceCategoryAxis3D- Returns:
- The width of a single category.
-
configureAsRowAxis
Configures the axis to be used as a row axis for the specified plot. This method is for internal use, you should not call it directly.- Specified by:
configureAsRowAxisin interfaceCategoryAxis3D- Parameters:
plot- the plot (nullnot permitted).
-
configureAsColumnAxis
Configures the axis to be used as a column axis for the specified plot. This method is for internal use, you won't normally need to call it directly.- Specified by:
configureAsColumnAxisin interfaceCategoryAxis3D- Parameters:
plot- the plot (nullnot permitted).
-
getCategoryValue
Returns the value for the specified category, orDouble.NaNif the category is not registered on the axis.- Specified by:
getCategoryValuein interfaceCategoryAxis3D- Parameters:
category- the category (nullnot permitted).- Returns:
- The value.
-
translateToWorld
Translates a value on the axis to the equivalent coordinate in the 3D world used to construct a model of the chart.- Specified by:
translateToWorldin interfaceAxis3D- Parameters:
value- the value along the axis.length- the length of one side of the 3D box containing the model.- Returns:
- A coordinate in 3D space.
-
draw
public void draw(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt, List<TickData> tickData, RenderingInfo info, boolean hinting) Draws the axis between the two pointspt0andpt1in Java2D space.- Specified by:
drawin interfaceAxis3D- Specified by:
drawin classAbstractAxis3D- Parameters:
g2- the graphics target (nullnot permitted).pt0- the starting point for the axis (nullnot permitted).pt1- the ending point for the axis (nullnot permitted).opposingPt- a point on the opposite side of the line from the labels (nullnot permitted).tickData- the tick data, contains positioning anchors calculated by the 3D engine (nullnot permitted).info- an object to be populated with rendering info (nullpermitted).hinting- perform element hinting?
-
axisStr
Returns "row" if the axis has been configured as a row axis, "column" if the axis has been configured as a column axis, and the empty string ("") if the axis has not yet been configured.- Specified by:
axisStrin classAbstractAxis3D- Returns:
- A string (never
null). - Since:
- 1.3
-
generateTickDataForRows
Generates the tick data for the axis (assumes the axis is being used as the row axis). The dataset is passed as an argument to provide the opportunity to incorporate dataset-specific info into tick labels (for example, a row label might show the total for that row in the dataset) ---whether or not this is used depends on the axis implementation.- Specified by:
generateTickDataForRowsin interfaceCategoryAxis3D- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The tick data.
- Since:
- 1.2
-
generateTickDataForColumns
Generates the tick data for the axis (assumes the axis is being used as the row axis). The dataset is passed as an argument to provide the opportunity to incorporate dataset-specific info into tick labels (for example, a row label might show the total for that row in the dataset) ---whether or not this is used depends on the axis implementation.- Specified by:
generateTickDataForColumnsin interfaceCategoryAxis3D- Parameters:
dataset- the dataset (nullnot permitted).- Returns:
- The tick data.
- Since:
- 1.2
-
generateMarkerData
Generates and returns a list of marker data items for the axis.- Specified by:
generateMarkerDatain interfaceCategoryAxis3D- Returns:
- A list of marker data items (never
null).
-
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:
receivein interfaceChartElement- Specified by:
receivein classAbstractAxis3D- Parameters:
visitor- the visitor (nullnot permitted).- Since:
- 1.2
-
equals
Tests this instance for equality with an arbitrary object.- Overrides:
equalsin classAbstractAxis3D- Parameters:
obj- the object to test against (nullnot permitted).- Returns:
- A boolean.
-
isInverted
Returnstrueif the axis inverts the order of the data items, andfalseotherwise.- Specified by:
isInvertedin interfaceAxis3D- Returns:
- A boolean.
- Since:
- 1.5
-
setInverted
Sets the flag that controls whether or not the axis inverts the order of the data items and sends anAxis3DChangeEventto all registered listeners.- Specified by:
setInvertedin interfaceAxis3D- Parameters:
inverted- the new flag value.- Since:
- 1.5
-