Package org.jfree.chart.axis
Class CategoryLabelPosition
- java.lang.Object
-
- org.jfree.chart.axis.CategoryLabelPosition
-
- All Implemented Interfaces:
java.io.Serializable
public class CategoryLabelPosition extends java.lang.Object implements java.io.SerializableThe attributes that control the position of the labels for the categories on aCategoryAxis. Instances of this class are immutable and other JFreeChart classes rely upon this.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private doubleangleThe rotation angle (in radians).private RectangleAnchorcategoryAnchorThe category anchor point.private TextBlockAnchorlabelAnchorThe text block anchor.private TextAnchorrotationAnchorThe rotation anchor.private static longserialVersionUIDFor serialization.private floatwidthRatioThe maximum label width as a percentage of the category space or the range space.private CategoryLabelWidthTypewidthTypeThe width calculation type.
-
Constructor Summary
Constructors Constructor Description CategoryLabelPosition()Creates a new position record with default settings.CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor)Creates a new category label position record.CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor, CategoryLabelWidthType widthType, float widthRatio)Creates a new category label position record.CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor, TextAnchor rotationAnchor, double angle, CategoryLabelWidthType widthType, float widthRatio)Creates a new position record.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object obj)Tests this instance for equality with an arbitrary object.doublegetAngle()Returns the angle of rotation for the label.RectangleAnchorgetCategoryAnchor()Returns the item label anchor.TextBlockAnchorgetLabelAnchor()Returns the text block anchor.TextAnchorgetRotationAnchor()Returns the rotation anchor point.floatgetWidthRatio()Returns the ratio used to calculate the maximum category label width.CategoryLabelWidthTypegetWidthType()Returns the width calculation type.inthashCode()Returns a hash code for this object.
-
-
-
Field Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
categoryAnchor
private final RectangleAnchor categoryAnchor
The category anchor point.
-
labelAnchor
private final TextBlockAnchor labelAnchor
The text block anchor.
-
rotationAnchor
private final TextAnchor rotationAnchor
The rotation anchor.
-
angle
private final double angle
The rotation angle (in radians).
-
widthType
private final CategoryLabelWidthType widthType
The width calculation type.
-
widthRatio
private final float widthRatio
The maximum label width as a percentage of the category space or the range space.
-
-
Constructor Detail
-
CategoryLabelPosition
public CategoryLabelPosition()
Creates a new position record with default settings.
-
CategoryLabelPosition
public CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor)
Creates a new category label position record.- Parameters:
categoryAnchor- the category anchor (nullnot permitted).labelAnchor- the label anchor (nullnot permitted).
-
CategoryLabelPosition
public CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor, CategoryLabelWidthType widthType, float widthRatio)
Creates a new category label position record.- Parameters:
categoryAnchor- the category anchor (nullnot permitted).labelAnchor- the label anchor (nullnot permitted).widthType- the width type (nullnot permitted).widthRatio- the maximum label width as a percentage (of the category space or the range space).
-
CategoryLabelPosition
public CategoryLabelPosition(RectangleAnchor categoryAnchor, TextBlockAnchor labelAnchor, TextAnchor rotationAnchor, double angle, CategoryLabelWidthType widthType, float widthRatio)
Creates a new position record. The item label anchor is a point relative to the data item (dot, bar or other visual item) on a chart. The item label is aligned by aligning the text anchor with the item label anchor.- Parameters:
categoryAnchor- the category anchor (nullnot permitted).labelAnchor- the label anchor (nullnot permitted).rotationAnchor- the rotation anchor (nullnot permitted).angle- the rotation angle (nullnot permitted).widthType- the width type (nullnot permitted).widthRatio- the maximum label width as a percentage (of the category space or the range space).
-
-
Method Detail
-
getCategoryAnchor
public RectangleAnchor getCategoryAnchor()
Returns the item label anchor.- Returns:
- The item label anchor (never
null).
-
getLabelAnchor
public TextBlockAnchor getLabelAnchor()
Returns the text block anchor.- Returns:
- The text block anchor (never
null).
-
getRotationAnchor
public TextAnchor getRotationAnchor()
Returns the rotation anchor point.- Returns:
- The rotation anchor point (never
null).
-
getAngle
public double getAngle()
Returns the angle of rotation for the label.- Returns:
- The angle (in radians).
-
getWidthType
public CategoryLabelWidthType getWidthType()
Returns the width calculation type.- Returns:
- The width calculation type (never
null).
-
getWidthRatio
public float getWidthRatio()
Returns the ratio used to calculate the maximum category label width.- Returns:
- The ratio.
-
equals
public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equalsin classjava.lang.Object- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- A hash code.
-
-