org.jfree.chart.annotations

Class CategoryTextAnnotation

public class CategoryTextAnnotation extends TextAnnotation implements CategoryAnnotation, Cloneable, Serializable

A text annotation that can be placed on a CategoryPlot.
Constructor Summary
CategoryTextAnnotation(String text, Comparable category, double value)
Creates a new annotation to be displayed at the given location.
Method Summary
Objectclone()
Returns a clone of the annotation.
voiddraw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)
Draws the annotation.
booleanequals(Object obj)
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.
inthashCode()
Returns a hash code for this instance.
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.

Constructor Detail

CategoryTextAnnotation

public CategoryTextAnnotation(String text, Comparable category, double value)
Creates a new annotation to be displayed at the given location.

Parameters: text the text (null not permitted). category the category (null not permitted). value the value.

Method Detail

clone

public Object clone()
Returns a clone of the annotation.

Returns: A clone.

Throws: CloneNotSupportedException this class will not throw this exception, but subclasses (if any) might.

draw

public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)
Draws the annotation.

Parameters: g2 the graphics device. plot the plot. dataArea the data area. domainAxis the domain axis. rangeAxis the range axis.

equals

public boolean equals(Object obj)
Tests this object for equality with another.

Parameters: obj the object (null permitted).

Returns: true or false.

getCategory

public Comparable getCategory()
Returns the category.

Returns: The category (never null).

See Also: setCategory

getCategoryAnchor

public CategoryAnchor getCategoryAnchor()
Returns the category anchor point.

Returns: The category anchor point.

See Also: setCategoryAnchor

getValue

public double getValue()
Returns the value that the annotation attaches to.

Returns: The value.

See Also: CategoryTextAnnotation

hashCode

public int hashCode()
Returns a hash code for this instance.

Returns: A hash code.

setCategory

public void setCategory(Comparable category)
Sets the category that the annotation attaches to.

Parameters: category the category (null not permitted).

See Also: getCategory

setCategoryAnchor

public void setCategoryAnchor(CategoryAnchor anchor)
Sets the category anchor point.

Parameters: anchor the anchor point (null not permitted).

See Also: getCategoryAnchor

setValue

public void setValue(double value)
Sets the value.

Parameters: value the value.

See Also: getValue