Package org.jfree.chart.axis
Class SubCategoryAxis
java.lang.Object
org.jfree.chart.axis.Axis
org.jfree.chart.axis.CategoryAxis
org.jfree.chart.axis.SubCategoryAxis
- All Implemented Interfaces:
Serializable,Cloneable
public class SubCategoryAxis extends CategoryAxis implements Cloneable, Serializable
A specialised category axis that can display sub-categories.
- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class org.jfree.chart.axis.CategoryAxis
DEFAULT_AXIS_MARGIN, DEFAULT_CATEGORY_MARGINFields inherited from class org.jfree.chart.axis.Axis
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE -
Constructor Summary
Constructors Constructor Description SubCategoryAxis(String label)Creates a new axis. -
Method Summary
Modifier and Type Method Description voidaddSubCategory(Comparable subCategory)Adds a sub-category to the axis.AxisStatedraw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)Draws the axis on a Java 2D graphics device (such as the screen or a printer).booleanequals(Object obj)Tests the axis for equality with an arbitrary object.FontgetSubLabelFont()Returns the font used to display the sub-category labels.PaintgetSubLabelPaint()Returns the paint used to display the sub-category labels.AxisSpacereserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)Estimates the space required for the axis, given a specific drawing area.voidsetSubLabelFont(Font font)Sets the font used to display the sub-category labels and sends anAxisChangeEventto all registered listeners.voidsetSubLabelPaint(Paint paint)Sets the paint used to display the sub-category labels and sends anAxisChangeEventto all registered listeners.Methods inherited from class org.jfree.chart.axis.CategoryAxis
addCategoryLabelToolTip, clearCategoryLabelToolTips, clone, configure, getBottomCategoryLabelPosition, getCategoryEnd, getCategoryJava2DCoordinate, getCategoryLabelPositionOffset, getCategoryLabelPositions, getCategoryMargin, getCategoryMiddle, getCategoryStart, getLeftCategoryLabelPosition, getLowerMargin, getMaxCategoryLabelWidthRatio, getRightCategoryLabelPosition, getSkipCategoryLabelsToFit, getTopCategoryLabelPosition, getUpperMargin, isVerticalCategoryLabels, refreshTicks, removeCategoryLabelToolTip, reserveSpace, setBottomCategoryLabelPosition, setCategoryLabelPositionOffset, setCategoryLabelPositions, setCategoryMargin, setLeftCategoryLabelPosition, setLowerMargin, setMaxCategoryLabelWidthRatio, setRightCategoryLabelPosition, setSkipCategoryLabelsToFit, setSkipLabels, setTopCategoryLabelPosition, setUpperMargin, setVerticalCategoryLabelsMethods inherited from class org.jfree.chart.axis.Axis
addChangeListener, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelFont, getLabelInsets, getLabelPaint, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, isAxisLineVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, removeChangeListener, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
-
Constructor Details
-
SubCategoryAxis
Creates a new axis.- Parameters:
label- the axis label.
-
-
Method Details
-
addSubCategory
Adds a sub-category to the axis.- Parameters:
subCategory- the sub-category.
-
getSubLabelFont
Returns the font used to display the sub-category labels.- Returns:
- The font (never
null).
-
setSubLabelFont
Sets the font used to display the sub-category labels and sends anAxisChangeEventto all registered listeners.- Parameters:
font- the font (nullnot permitted).
-
getSubLabelPaint
Returns the paint used to display the sub-category labels.- Returns:
- The paint (never
null).
-
setSubLabelPaint
Sets the paint used to display the sub-category labels and sends anAxisChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).
-
reserveSpace
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)Estimates the space required for the axis, given a specific drawing area.- Parameters:
g2- the graphics device (used to obtain font information).plot- the plot that the axis belongs to.plotArea- the area within which the axis should be drawn.edge- the axis location (top or bottom).space- the space already reserved.- Returns:
- The space required to draw the axis.
-
draw
public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)Draws the axis on a Java 2D graphics device (such as the screen or a printer).- Overrides:
drawin classCategoryAxis- Parameters:
g2- the graphics device (nullnot permitted).cursor- the cursor location.plotArea- the area within which the axis should be drawn (nullnot permitted).dataArea- the area within which the plot is being drawn (nullnot permitted).edge- the location of the axis (nullnot permitted).plotState- collects information about the plot (nullpermitted).- Returns:
- the axis state (never
null).
-
equals
Tests the axis for equality with an arbitrary object.- Overrides:
equalsin classCategoryAxis- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-