public class

XYTextAnnotation

extends AbstractXYAnnotation
implements Serializable Cloneable
java.lang.Object
   ↳ org.jfree.chart.annotations.AbstractXYAnnotation
     ↳ org.jfree.chart.annotations.XYTextAnnotation
Known Direct Subclasses

Class Overview

A text annotation that can be placed at a particular (x, y) location on an XYPlot.

Summary

Constants
double DEFAULT_ROTATION_ANGLE The default rotation angle.
Fields
public static final Font DEFAULT_FONT The default font.
public static final Paint DEFAULT_PAINT The default paint.
public static final TextAnchor DEFAULT_ROTATION_ANCHOR The default rotation anchor.
public static final TextAnchor DEFAULT_TEXT_ANCHOR The default text anchor.
Public Constructors
XYTextAnnotation(String text, double x, double y)
Creates a new annotation to be displayed at the given coordinates.
Public Methods
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.
Paint getBackgroundPaint()
Returns the background paint for the annotation.
Font getFont()
Returns the font for the annotation.
Paint getOutlinePaint()
Returns the outline paint for the annotation.
Stroke getOutlineStroke()
Returns the outline stroke 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.
boolean isOutlineVisible()
Returns the flag that controls whether or not the outline is drawn.
void setBackgroundPaint(Paint paint)
Sets the background paint for the annotation.
void setFont(Font font)
Sets the font for the annotation.
void setOutlinePaint(Paint paint)
Sets the outline paint for the annotation.
void setOutlineStroke(Stroke stroke)
Sets the outline stroke for the annotation.
void setOutlineVisible(boolean visible)
Sets the flag that controls whether or not the outline is drawn.
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).
[Expand]
Inherited Methods
From class org.jfree.chart.annotations.AbstractXYAnnotation
From class java.lang.Object
From interface org.jfree.chart.annotations.XYAnnotation

Constants

public static final double DEFAULT_ROTATION_ANGLE

The default rotation angle.

Constant Value: 0.0

Fields

public static final Font DEFAULT_FONT

The default font.

public static final Paint DEFAULT_PAINT

The default paint.

public static final TextAnchor DEFAULT_ROTATION_ANCHOR

The default rotation anchor.

public static final TextAnchor DEFAULT_TEXT_ANCHOR

The default text anchor.

Public Constructors

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).

Parameters
text the text (null not permitted).
x the x-coordinate (in data space).
y the y-coordinate (in data space).

Public Methods

public Object clone ()

Returns a clone of the annotation.

Returns
  • A clone.
Throws
CloneNotSupportedException if the annotation can't be cloned.

public void draw (Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info)

Draws the annotation.

Parameters
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.

public boolean equals (Object obj)

Tests this annotation for equality with an arbitrary object.

Parameters
obj the object (null permitted).
Returns
  • A boolean.

public Paint getBackgroundPaint ()

Returns the background paint for the annotation.

Returns
  • The background paint (possibly null).

public Font getFont ()

Returns the font for the annotation.

Returns
  • The font (never null).
See Also

public Paint getOutlinePaint ()

Returns the outline paint for the annotation.

Returns
  • The outline paint (never null).

public Stroke getOutlineStroke ()

Returns the outline stroke for the annotation.

Returns
  • The outline stroke (never null).

public Paint getPaint ()

Returns the paint for the annotation.

Returns
  • The paint (never null).
See Also

public TextAnchor getRotationAnchor ()

Returns the rotation anchor.

Returns
  • The rotation anchor point (never null).

public double getRotationAngle ()

Returns the rotation angle.

Returns
  • The rotation angle.

public String getText ()

Returns the text for the annotation.

Returns
  • The text (never null).
See Also

public TextAnchor getTextAnchor ()

Returns the text anchor.

Returns
  • The text anchor (never null).

public double getX ()

Returns the x coordinate for the text anchor point (measured against the domain axis).

Returns
  • The x coordinate (in data space).
See Also

public double getY ()

Returns the y coordinate for the text anchor point (measured against the range axis).

Returns
  • The y coordinate (in data space).
See Also

public int hashCode ()

Returns a hash code for the object.

Returns
  • A hash code.

public boolean isOutlineVisible ()

Returns the flag that controls whether or not the outline is drawn.

Returns
  • A boolean.

public void setBackgroundPaint (Paint paint)

Sets the background paint for the annotation.

Parameters
paint the paint (null permitted).

public void setFont (Font font)

Sets the font for the annotation.

Parameters
font the font (null not permitted).
See Also

public void setOutlinePaint (Paint paint)

Sets the outline paint for the annotation.

Parameters
paint the paint (null not permitted).

public void setOutlineStroke (Stroke stroke)

Sets the outline stroke for the annotation.

Parameters
stroke the stroke (null not permitted).

public void setOutlineVisible (boolean visible)

Sets the flag that controls whether or not the outline is drawn.

Parameters
visible the new flag value.

public void setPaint (Paint paint)

Sets the paint for the annotation.

Parameters
paint the paint (null not permitted).
See Also

public void setRotationAnchor (TextAnchor anchor)

Sets the rotation anchor point.

Parameters
anchor the anchor (null not permitted).

public void setRotationAngle (double angle)

Sets the rotation angle. The angle is measured clockwise in radians.

Parameters
angle the angle (in radians).

public void setText (String text)

Sets the text for the annotation.

Parameters
text the text (null not permitted).
See Also

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).

Parameters
anchor the anchor point (null not permitted).
See Also

public void setX (double x)

Sets the x coordinate for the text anchor point (measured against the domain axis).

Parameters
x the x coordinate (in data space).
See Also

public void setY (double y)

Sets the y coordinate for the text anchor point (measured against the range axis).

Parameters
y the y coordinate.
See Also