Package org.jfree.chart.annotations
Class CategoryTextAnnotation
java.lang.Object
org.jfree.chart.annotations.TextAnnotation
org.jfree.chart.annotations.CategoryTextAnnotation
- All Implemented Interfaces:
Serializable,Cloneable,CategoryAnnotation
public class CategoryTextAnnotation extends TextAnnotation implements CategoryAnnotation, Cloneable, Serializable
A text annotation that can be placed on a
CategoryPlot.- See Also:
- Serialized Form
-
Field Summary
Fields inherited from class org.jfree.chart.annotations.TextAnnotation
DEFAULT_FONT, DEFAULT_PAINT, DEFAULT_ROTATION_ANCHOR, DEFAULT_ROTATION_ANGLE, DEFAULT_TEXT_ANCHOR -
Constructor Summary
Constructors Constructor Description CategoryTextAnnotation(String text, Comparable category, double value)Creates a new annotation to be displayed at the given location. -
Method Summary
Modifier and Type Method Description Objectclone()Returns a clone of the annotation.voiddraw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)Draws the annotation.booleanequals(Object object)Tests this object for equality with another.ComparablegetCategory()Returns the category.CategoryAnchorgetCategoryAnchor()Returns the category anchor point.doublegetValue()Returns the value that the annotation attaches to.voidsetCategory(Comparable category)Sets the category that the annotation attaches to.voidsetCategoryAnchor(CategoryAnchor anchor)Sets the category anchor point.voidsetValue(double value)Sets the value.Methods inherited from class org.jfree.chart.annotations.TextAnnotation
getFont, getPaint, getRotationAnchor, getRotationAngle, getText, getTextAnchor, setFont, setPaint, setRotationAnchor, setRotationAngle, setText, setTextAnchor
-
Constructor Details
-
CategoryTextAnnotation
Creates a new annotation to be displayed at the given location.- Parameters:
text- the text.category- the category.value- the value.
-
-
Method Details
-
getCategory
Returns the category.- Returns:
- The category.
-
setCategory
Sets the category that the annotation attaches to.- Parameters:
category- the category.
-
getCategoryAnchor
Returns the category anchor point.- Returns:
- The category anchor point.
-
setCategoryAnchor
Sets the category anchor point.- Parameters:
anchor- the anchor point.
-
getValue
public double getValue()Returns the value that the annotation attaches to.- Returns:
- The value.
-
setValue
public void setValue(double value)Sets the value.- Parameters:
value- the value.
-
draw
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)Draws the annotation.- Specified by:
drawin interfaceCategoryAnnotation- Parameters:
g2- the graphics device.plot- the plot.dataArea- the data area.domainAxis- the domain axis.rangeAxis- the range axis.
-
equals
Tests this object for equality with another.- Overrides:
equalsin classTextAnnotation- Parameters:
object- the object to test against.- Returns:
trueorfalse.
-
clone
Returns a clone of the annotation.- Returns:
- A clone.
- Throws:
CloneNotSupportedException- this class will not throw this exception, but subclasses (if any) might.
-