public class CategoryPointerAnnotation extends CategoryTextAnnotation implements Cloneable, org.jfree.util.PublicCloneable, Serializable
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.
Modifier and Type | Field and Description |
---|---|
static double |
DEFAULT_ARROW_LENGTH
The default arrow length (in Java2D units).
|
static double |
DEFAULT_ARROW_WIDTH
The default arrow width (in Java2D units).
|
static double |
DEFAULT_BASE_RADIUS
The default base radius (in Java2D units).
|
static double |
DEFAULT_LABEL_OFFSET
The default label offset (in Java2D units).
|
static double |
DEFAULT_TIP_RADIUS
The default tip radius (in Java2D units).
|
DEFAULT_FONT, DEFAULT_PAINT, DEFAULT_ROTATION_ANCHOR, DEFAULT_ROTATION_ANGLE, DEFAULT_TEXT_ANCHOR
Constructor and Description |
---|
CategoryPointerAnnotation(String label,
Comparable key,
double value,
double angle)
Creates a new label and arrow annotation.
|
Modifier and Type | Method and Description |
---|---|
Object |
clone()
Returns a clone of the annotation.
|
void |
draw(Graphics2D g2,
CategoryPlot plot,
Rectangle2D dataArea,
CategoryAxis domainAxis,
ValueAxis rangeAxis)
Draws the annotation.
|
boolean |
equals(Object obj)
Tests this annotation for equality with an arbitrary object.
|
double |
getAngle()
Returns the angle of the arrow.
|
double |
getArrowLength()
Returns the arrow length.
|
Paint |
getArrowPaint()
Returns the paint used for the arrow.
|
Stroke |
getArrowStroke()
Returns the stroke used to draw the arrow line.
|
double |
getArrowWidth()
Returns the arrow width.
|
double |
getBaseRadius()
Returns the base radius.
|
double |
getLabelOffset()
Returns the label offset.
|
double |
getTipRadius()
Returns the tip radius.
|
int |
hashCode()
Returns a hash code for this instance.
|
void |
setAngle(double angle)
Sets the angle of the arrow and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setArrowLength(double length)
Sets the arrow length and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setArrowPaint(Paint paint)
Sets the paint used for the arrow and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setArrowStroke(Stroke stroke)
Sets the stroke used to draw the arrow line and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setArrowWidth(double width)
Sets the arrow width and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setBaseRadius(double radius)
Sets the base radius and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setLabelOffset(double offset)
Sets the label offset (from the arrow base, continuing in a straight
line, in Java2D units) and sends an
AnnotationChangeEvent to all registered listeners. |
void |
setTipRadius(double radius)
Sets the tip radius and sends an
AnnotationChangeEvent to all registered listeners. |
getCategory, getCategoryAnchor, getValue, setCategory, setCategoryAnchor, setValue
getFont, getPaint, getRotationAnchor, getRotationAngle, getText, getTextAnchor, setFont, setPaint, setRotationAnchor, setRotationAngle, setText, setTextAnchor
addChangeListener, getNotify, hasListener, removeChangeListener, setNotify
getClass, notify, notifyAll, toString, wait, wait, wait
addChangeListener, removeChangeListener
public static final double DEFAULT_TIP_RADIUS
public static final double DEFAULT_BASE_RADIUS
public static final double DEFAULT_LABEL_OFFSET
public static final double DEFAULT_ARROW_LENGTH
public static final double DEFAULT_ARROW_WIDTH
public CategoryPointerAnnotation(String label, Comparable key, double value, double angle)
label
- the label (null
permitted).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).public double getAngle()
setAngle(double)
public void setAngle(double angle)
AnnotationChangeEvent
to all registered listeners.angle
- the angle (in radians).getAngle()
public double getTipRadius()
setTipRadius(double)
public void setTipRadius(double radius)
AnnotationChangeEvent
to all registered listeners.radius
- the radius (in Java2D units).getTipRadius()
public double getBaseRadius()
setBaseRadius(double)
public void setBaseRadius(double radius)
AnnotationChangeEvent
to all registered listeners.radius
- the radius (in Java2D units).getBaseRadius()
public double getLabelOffset()
setLabelOffset(double)
public void setLabelOffset(double offset)
AnnotationChangeEvent
to all registered listeners.offset
- the offset (in Java2D units).getLabelOffset()
public double getArrowLength()
setArrowLength(double)
public void setArrowLength(double length)
AnnotationChangeEvent
to all registered listeners.length
- the length.getArrowLength()
public double getArrowWidth()
setArrowWidth(double)
public void setArrowWidth(double width)
AnnotationChangeEvent
to all registered listeners.width
- the width (in Java2D units).getArrowWidth()
public Stroke getArrowStroke()
null
).setArrowStroke(Stroke)
public void setArrowStroke(Stroke stroke)
AnnotationChangeEvent
to all registered listeners.stroke
- the stroke (null
not permitted).getArrowStroke()
public Paint getArrowPaint()
null
).setArrowPaint(Paint)
public void setArrowPaint(Paint paint)
AnnotationChangeEvent
to all registered listeners.paint
- the arrow paint (null
not permitted).getArrowPaint()
public void draw(Graphics2D g2, CategoryPlot plot, Rectangle2D dataArea, CategoryAxis domainAxis, ValueAxis rangeAxis)
draw
in interface CategoryAnnotation
draw
in class CategoryTextAnnotation
g2
- the graphics device.plot
- the plot.dataArea
- the data area.domainAxis
- the domain axis.rangeAxis
- the range axis.public boolean equals(Object obj)
equals
in class CategoryTextAnnotation
obj
- the object (null
permitted).true
or false
.public int hashCode()
hashCode
in class CategoryTextAnnotation
public Object clone() throws CloneNotSupportedException
clone
in interface org.jfree.util.PublicCloneable
clone
in class CategoryTextAnnotation
CloneNotSupportedException
- if the annotation can't be cloned.Jas4pp 1.5 © Java Analysis Studio for Particle Physics