Package org.jfree.chart.annotations
Class CategoryTextAnnotation
java.lang.Object
org.jfree.chart.annotations.AbstractAnnotation
org.jfree.chart.annotations.TextAnnotation
org.jfree.chart.annotations.CategoryTextAnnotation
- All Implemented Interfaces:
Serializable,Cloneable,Annotation,CategoryAnnotation,PublicCloneable
- Direct Known Subclasses:
CategoryPointerAnnotation
public class CategoryTextAnnotation
extends TextAnnotation
implements CategoryAnnotation, Cloneable, PublicCloneable, Serializable
A text annotation that can be placed on a
CategoryPlot.- See Also:
-
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
ConstructorsConstructorDescriptionCategoryTextAnnotation(String text, Comparable category, double value) Creates a new annotation to be displayed at the given location. -
Method Summary
Modifier and TypeMethodDescriptionbooleanEnsures symmetry between super/subclass implementations of equals.clone()Returns a clone of the annotation.voiddraw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) Draws the annotation.booleanTests this object for equality with another.Returns the category.Returns the category anchor point.doublegetValue()Returns the value that the annotation attaches to.inthashCode()Returns a hash code for this instance.voidsetCategory(Comparable category) Sets the category that the annotation attaches to and sends anAnnotationChangeEventto all registered listeners.voidsetCategoryAnchor(CategoryAnchor anchor) Sets the category anchor point and sends anAnnotationChangeEventto all registered listeners.voidsetValue(double value) Sets the value and sends anAnnotationChangeEventto all registered listeners.Methods inherited from class org.jfree.chart.annotations.TextAnnotation
getFont, getPaint, getRotationAnchor, getRotationAngle, getText, getTextAnchor, setFont, setPaint, setRotationAnchor, setRotationAngle, setText, setTextAnchorMethods inherited from class org.jfree.chart.annotations.AbstractAnnotation
addChangeListener, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotifyMethods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart.annotations.Annotation
addChangeListener, removeChangeListener
-
Constructor Details
-
CategoryTextAnnotation
Creates a new annotation to be displayed at the given location.- Parameters:
text- the text (nullnot permitted).category- the category (nullnot permitted).value- the value.
-
-
Method Details
-
getCategory
Returns the category.- Returns:
- The category (never
null). - See Also:
-
setCategory
Sets the category that the annotation attaches to and sends anAnnotationChangeEventto all registered listeners.- Parameters:
category- the category (nullnot permitted).- See Also:
-
getCategoryAnchor
Returns the category anchor point.- Returns:
- The category anchor point.
- See Also:
-
setCategoryAnchor
Sets the category anchor point and sends anAnnotationChangeEventto all registered listeners.- Parameters:
anchor- the anchor point (nullnot permitted).- See Also:
-
getValue
Returns the value that the annotation attaches to.- Returns:
- The value.
- See Also:
-
setValue
Sets the value and sends anAnnotationChangeEventto all registered listeners.- Parameters:
value- the value.- See Also:
-
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:
obj- the object (nullpermitted).- Returns:
trueorfalse.
-
canEqual
Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.- Overrides:
canEqualin classTextAnnotation- Parameters:
other- Object- Returns:
- true ONLY if the parameter is THIS class type
-
hashCode
Returns a hash code for this instance.- Overrides:
hashCodein classTextAnnotation- Returns:
- A hash code.
-
clone
Returns a clone of the annotation.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAbstractAnnotation- Returns:
- A clone.
- Throws:
CloneNotSupportedException- this class will not throw this exception, but subclasses (if any) might.
-