java.lang.Object
org.jfree.chart.annotations.AbstractAnnotation
org.jfree.chart.annotations.TextAnnotation
org.jfree.chart.annotations.CategoryTextAnnotation
org.jfree.chart.annotations.CategoryPointerAnnotation
- All Implemented Interfaces:
- Serializable,- Cloneable,- Annotation,- CategoryAnnotation,- PublicCloneable
public class CategoryPointerAnnotation
extends CategoryTextAnnotation
implements Cloneable, PublicCloneable, Serializable
An arrow and label that can be placed on a 
CategoryPlot.  The arrow
 is drawn at a user-definable angle so that it points towards the (category,
 value) location for the annotation.
 The arrow length (and its offset from the (category, value) location) is controlled by the tip radius and the base radius attributes. Imagine two circles around the (category, value) coordinate: the inner circle defined by the tip radius, and the outer circle defined by the base radius. Now, draw the arrow starting at some point on the outer circle (the point is determined by the angle), with the arrow tip being drawn at a corresponding point on the inner circle.
- See Also:
- 
Field SummaryFieldsModifier and TypeFieldDescriptionstatic final doubleThe default arrow length (in Java2D units).static final doubleThe default arrow width (in Java2D units).static final doubleThe default base radius (in Java2D units).static final doubleThe default label offset (in Java2D units).static final doubleThe default tip radius (in Java2D units).Fields inherited from class org.jfree.chart.annotations.TextAnnotationDEFAULT_FONT, DEFAULT_PAINT, DEFAULT_ROTATION_ANCHOR, DEFAULT_ROTATION_ANGLE, DEFAULT_TEXT_ANCHOR
- 
Constructor SummaryConstructorsConstructorDescriptionCategoryPointerAnnotation(String label, Comparable key, double value, double angle) Creates a new label and arrow annotation.
- 
Method SummaryModifier and TypeMethodDescriptionclone()Returns a clone of the annotation.voiddraw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) Draws the annotation.booleanTests this annotation for equality with an arbitrary object.doublegetAngle()Returns the angle of the arrow.doubleReturns the arrow length.Returns the paint used for the arrow.Returns the stroke used to draw the arrow line.doubleReturns the arrow width.doubleReturns the base radius.doubleReturns the label offset.doubleReturns the tip radius.inthashCode()Returns a hash code for this instance.voidsetAngle(double angle) Sets the angle of the arrow and sends anAnnotationChangeEventto all registered listeners.voidsetArrowLength(double length) Sets the arrow length and sends anAnnotationChangeEventto all registered listeners.voidsetArrowPaint(Paint paint) Sets the paint used for the arrow and sends anAnnotationChangeEventto all registered listeners.voidsetArrowStroke(Stroke stroke) Sets the stroke used to draw the arrow line and sends anAnnotationChangeEventto all registered listeners.voidsetArrowWidth(double width) Sets the arrow width and sends anAnnotationChangeEventto all registered listeners.voidsetBaseRadius(double radius) Sets the base radius and sends anAnnotationChangeEventto all registered listeners.voidsetLabelOffset(double offset) Sets the label offset (from the arrow base, continuing in a straight line, in Java2D units) and sends anAnnotationChangeEventto all registered listeners.voidsetTipRadius(double radius) Sets the tip radius and sends anAnnotationChangeEventto all registered listeners.Methods inherited from class org.jfree.chart.annotations.CategoryTextAnnotationgetCategory, getCategoryAnchor, getValue, setCategory, setCategoryAnchor, setValueMethods inherited from class org.jfree.chart.annotations.TextAnnotationgetFont, getPaint, getRotationAnchor, getRotationAngle, getText, getTextAnchor, setFont, setPaint, setRotationAnchor, setRotationAngle, setText, setTextAnchorMethods inherited from class org.jfree.chart.annotations.AbstractAnnotationaddChangeListener, fireAnnotationChanged, getNotify, hasListener, notifyListeners, removeChangeListener, setNotifyMethods inherited from class java.lang.Objectfinalize, getClass, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.jfree.chart.annotations.AnnotationaddChangeListener, removeChangeListener
- 
Field Details- 
DEFAULT_TIP_RADIUSpublic static final double DEFAULT_TIP_RADIUSThe default tip radius (in Java2D units).- See Also:
 
- 
DEFAULT_BASE_RADIUSpublic static final double DEFAULT_BASE_RADIUSThe default base radius (in Java2D units).- See Also:
 
- 
DEFAULT_LABEL_OFFSETpublic static final double DEFAULT_LABEL_OFFSETThe default label offset (in Java2D units).- See Also:
 
- 
DEFAULT_ARROW_LENGTHpublic static final double DEFAULT_ARROW_LENGTHThe default arrow length (in Java2D units).- See Also:
 
- 
DEFAULT_ARROW_WIDTHpublic static final double DEFAULT_ARROW_WIDTHThe default arrow width (in Java2D units).- See Also:
 
 
- 
- 
Constructor Details- 
CategoryPointerAnnotationCreates a new label and arrow annotation.- Parameters:
- label- the label (- nullpermitted).
- key- the category key.
- value- the y-value (measured against the chart's range axis).
- angle- the angle of the arrow's line (in radians).
 
 
- 
- 
Method Details- 
getAnglepublic double getAngle()Returns the angle of the arrow.- Returns:
- The angle (in radians).
- See Also:
 
- 
setAnglepublic void setAngle(double angle) Sets the angle of the arrow and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- angle- the angle (in radians).
- See Also:
 
- 
getTipRadiuspublic double getTipRadius()Returns the tip radius.- Returns:
- The tip radius (in Java2D units).
- See Also:
 
- 
setTipRadiuspublic void setTipRadius(double radius) Sets the tip radius and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- radius- the radius (in Java2D units).
- See Also:
 
- 
getBaseRadiuspublic double getBaseRadius()Returns the base radius.- Returns:
- The base radius (in Java2D units).
- See Also:
 
- 
setBaseRadiuspublic void setBaseRadius(double radius) Sets the base radius and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- radius- the radius (in Java2D units).
- See Also:
 
- 
getLabelOffsetpublic double getLabelOffset()Returns the label offset.- Returns:
- The label offset (in Java2D units).
- See Also:
 
- 
setLabelOffsetpublic void setLabelOffset(double offset) Sets the label offset (from the arrow base, continuing in a straight line, in Java2D units) and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- offset- the offset (in Java2D units).
- See Also:
 
- 
getArrowLengthpublic double getArrowLength()Returns the arrow length.- Returns:
- The arrow length.
- See Also:
 
- 
setArrowLengthpublic void setArrowLength(double length) Sets the arrow length and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- length- the length.
- See Also:
 
- 
getArrowWidthpublic double getArrowWidth()Returns the arrow width.- Returns:
- The arrow width (in Java2D units).
- See Also:
 
- 
setArrowWidthpublic void setArrowWidth(double width) Sets the arrow width and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- width- the width (in Java2D units).
- See Also:
 
- 
getArrowStrokeReturns the stroke used to draw the arrow line.- Returns:
- The arrow stroke (never null).
- See Also:
 
- 
setArrowStrokeSets the stroke used to draw the arrow line and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- stroke- the stroke (- nullnot permitted).
- See Also:
 
- 
getArrowPaintReturns the paint used for the arrow.- Returns:
- The arrow paint (never null).
- See Also:
 
- 
setArrowPaintSets the paint used for the arrow and sends anAnnotationChangeEventto all registered listeners.- Parameters:
- paint- the arrow paint (- nullnot permitted).
- See Also:
 
- 
drawpublic void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis) Draws the annotation.- Specified by:
- drawin interface- CategoryAnnotation
- Overrides:
- drawin class- CategoryTextAnnotation
- Parameters:
- g2- the graphics device.
- plot- the plot.
- dataArea- the data area.
- domainAxis- the domain axis.
- rangeAxis- the range axis.
 
- 
equalsTests this annotation for equality with an arbitrary object.- Overrides:
- equalsin class- CategoryTextAnnotation
- Parameters:
- obj- the object (- nullpermitted).
- Returns:
- trueor- false.
 
- 
hashCodepublic int hashCode()Returns a hash code for this instance.- Overrides:
- hashCodein class- CategoryTextAnnotation
- Returns:
- A hash code.
 
- 
cloneReturns a clone of the annotation.- Specified by:
- clonein interface- PublicCloneable
- Overrides:
- clonein class- CategoryTextAnnotation
- Returns:
- A clone.
- Throws:
- CloneNotSupportedException- if the annotation can't be cloned.
 
 
-