org.jfree.chart.annotations
Class XYPointerAnnotation
- Cloneable, PublicCloneable, Serializable, XYAnnotation
implements Cloneable, PublicCloneable, Serializable
An arrow and label that can be placed on an
XYPlot
. The arrow is drawn at a user-definable
angle so that it points towards the (x, y) location for the annotation.
The arrow length (and its offset from the (x, y) location) is controlled by
the tip radius and the base radius attributes. Imagine two circles around
the (x, y) 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.
XYPointerAnnotation(String label, double x, double y, double angle) - Creates a new label and arrow annotation.
|
clone , draw , equals , getFont , getPaint , getRotationAnchor , getRotationAngle , getText , getTextAnchor , getX , getY , hashCode , setFont , setPaint , setRotationAnchor , setRotationAngle , setText , setTextAnchor , setX , setY |
DEFAULT_ARROW_LENGTH
public static final double DEFAULT_ARROW_LENGTH
The default arrow length (in Java2D units).
DEFAULT_ARROW_WIDTH
public static final double DEFAULT_ARROW_WIDTH
The default arrow width (in Java2D units).
DEFAULT_BASE_RADIUS
public static final double DEFAULT_BASE_RADIUS
The default base radius (in Java2D units).
DEFAULT_LABEL_OFFSET
public static final double DEFAULT_LABEL_OFFSET
The default label offset (in Java2D units).
DEFAULT_TIP_RADIUS
public static final double DEFAULT_TIP_RADIUS
The default tip radius (in Java2D units).
XYPointerAnnotation
public XYPointerAnnotation(String label,
double x,
double y,
double angle)
Creates a new label and arrow annotation.
label
- the label (null
permitted).x
- the x-coordinate (measured against the chart's domain axis).y
- the y-coordinate (measured against the chart's range axis).angle
- the angle of the arrow's line (in radians).
clone
public Object clone()
throws CloneNotSupportedException
Returns a clone of the annotation.
- clone in interface XYTextAnnotation
draw
public void draw(Graphics2D g2,
XYPlot plot,
Rectangle2D dataArea,
ValueAxis domainAxis,
ValueAxis rangeAxis,
int rendererIndex,
PlotRenderingInfo info)
Draws the annotation.
- draw in interface XYAnnotation
- draw in interface XYTextAnnotation
g2
- the graphics device.plot
- the plot.dataArea
- the data area.domainAxis
- the domain axis.rangeAxis
- the range axis.rendererIndex
- the renderer index.info
- the plot rendering info.
equals
public boolean equals(Object obj)
Tests this annotation for equality with an arbitrary object.
- equals in interface XYTextAnnotation
obj
- the object (null
permitted).
getAngle
public double getAngle()
Returns the angle of the arrow.
getArrowLength
public double getArrowLength()
Returns the arrow length.
getArrowPaint
public Paint getArrowPaint()
Returns the paint used for the arrow.
- The arrow paint (never
null
).
getArrowStroke
public Stroke getArrowStroke()
Returns the stroke used to draw the arrow line.
- The arrow stroke (never
null
).
getArrowWidth
public double getArrowWidth()
Returns the arrow width.
- The arrow width (in Java2D units).
getBaseRadius
public double getBaseRadius()
Returns the base radius.
- The base radius (in Java2D units).
getLabelOffset
public double getLabelOffset()
Returns the label offset.
- The label offset (in Java2D units).
getTipRadius
public double getTipRadius()
Returns the tip radius.
- The tip radius (in Java2D units).
setAngle
public void setAngle(double angle)
Sets the angle of the arrow.
angle
- the angle (in radians).
setArrowLength
public void setArrowLength(double length)
Sets the arrow length.
setArrowPaint
public void setArrowPaint(Paint paint)
Sets the paint used for the arrow.
paint
- the arrow paint (null
not permitted).
setArrowStroke
public void setArrowStroke(Stroke stroke)
Sets the stroke used to draw the arrow line.
stroke
- the stroke (null
not permitted).
setArrowWidth
public void setArrowWidth(double width)
Sets the arrow width.
width
- the width (in Java2D units).
setBaseRadius
public void setBaseRadius(double radius)
Sets the base radius.
radius
- the radius (in Java2D units).
setLabelOffset
public void setLabelOffset(double offset)
Sets the label offset (from the arrow base, continuing in a straight
line, in Java2D units).
offset
- the offset (in Java2D units).
setTipRadius
public void setTipRadius(double radius)
Sets the tip radius.
radius
- the radius (in Java2D units).