org.jfree.chart.annotations
Class XYTextAnnotation
- Cloneable, PublicCloneable, Serializable, XYAnnotation
implements Cloneable, PublicCloneable, Serializable
A text annotation that can be placed at a particular (x, y) location on an
XYPlot
.
XYTextAnnotation(String text, double x, double y) - Creates a new annotation to be displayed at the given coordinates.
|
Object | clone() - Returns a clone of the annotation.
|
void | draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info) - Draws the annotation.
|
boolean | equals(Object obj) - Tests this annotation for equality with an arbitrary object.
|
Font | getFont() - Returns the font for the annotation.
|
Paint | getPaint() - Returns the paint for the annotation.
|
TextAnchor | getRotationAnchor() - Returns the rotation anchor.
|
double | getRotationAngle() - Returns the rotation angle.
|
String | getText() - Returns the text for the annotation.
|
TextAnchor | getTextAnchor() - Returns the text anchor.
|
double | getX() - Returns the x coordinate for the text anchor point (measured against the
domain axis).
|
double | getY() - Returns the y coordinate for the text anchor point (measured against the
range axis).
|
int | hashCode() - Returns a hash code for the object.
|
void | setFont(Font font) - Sets the font for the annotation.
|
void | setPaint(Paint paint) - Sets the paint for the annotation.
|
void | setRotationAnchor(TextAnchor anchor) - Sets the rotation anchor point.
|
void | setRotationAngle(double angle) - Sets the rotation angle.
|
void | setText(String text) - Sets the text for the annotation.
|
void | setTextAnchor(TextAnchor anchor) - Sets the text anchor (the point on the text bounding rectangle that is
aligned to the (x, y) coordinate of the annotation).
|
void | setX(double x) - Sets the x coordinate for the text anchor point (measured against the
domain axis).
|
void | setY(double y) - Sets the y coordinate for the text anchor point (measured against the
range axis).
|
DEFAULT_FONT
public static final Font DEFAULT_FONT
The default font.
DEFAULT_PAINT
public static final Paint DEFAULT_PAINT
The default paint.
XYTextAnnotation
public XYTextAnnotation(String text,
double x,
double y)
Creates a new annotation to be displayed at the given coordinates. The
coordinates are specified in data space (they will be converted to
Java2D space for display).
text
- the text (null
not permitted).x
- the x-coordinate (in data space).y
- the y-coordinate (in data space).
clone
public Object clone()
throws CloneNotSupportedException
Returns a clone of the annotation.
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 AbstractXYAnnotation
g2
- the graphics device.plot
- the plot.dataArea
- the data area.domainAxis
- the domain axis.rangeAxis
- the range axis.rendererIndex
- the renderer index.info
- an optional info object that will be populated with
entity information.
equals
public boolean equals(Object obj)
Tests this annotation for equality with an arbitrary object.
- equals in interface AbstractXYAnnotation
obj
- the object (null
permitted).
getFont
public Font getFont()
Returns the font for the annotation.
getPaint
public Paint getPaint()
Returns the paint for the annotation.
getRotationAnchor
public TextAnchor getRotationAnchor()
Returns the rotation anchor.
- The rotation anchor point.
getText
public String getText()
Returns the text for the annotation.
getTextAnchor
public TextAnchor getTextAnchor()
Returns the text anchor.
getX
public double getX()
Returns the x coordinate for the text anchor point (measured against the
domain axis).
- The x coordinate (in data space).
getY
public double getY()
Returns the y coordinate for the text anchor point (measured against the
range axis).
- The y coordinate (in data space).
hashCode
public int hashCode()
Returns a hash code for the object.
setFont
public void setFont(Font font)
Sets the font for the annotation.
setPaint
public void setPaint(Paint paint)
Sets the paint for the annotation.
setRotationAnchor
public void setRotationAnchor(TextAnchor anchor)
Sets the rotation anchor point.
setRotationAngle
public void setRotationAngle(double angle)
Sets the rotation angle.
The angle is measured clockwise in radians.
angle
- the angle (in radians).
setText
public void setText(String text)
Sets the text for the annotation.
text
- the text (null
not permitted).
setTextAnchor
public void setTextAnchor(TextAnchor anchor)
Sets the text anchor (the point on the text bounding rectangle that is
aligned to the (x, y) coordinate of the annotation).
anchor
- the anchor point.
setX
public void setX(double x)
Sets the x coordinate for the text anchor point (measured against the
domain axis).
x
- the x coordinate (in data space).
setY
public void setY(double y)
Sets the y coordinate for the text anchor point (measured against the
range axis).