Class XYTextAnnotation

java.lang.Object
org.jfree.chart.annotations.TextAnnotation
org.jfree.chart.annotations.XYTextAnnotation
All Implemented Interfaces:
Serializable, Cloneable, XYAnnotation
Direct Known Subclasses:
XYPointerAnnotation

public class XYTextAnnotation
extends TextAnnotation
implements XYAnnotation, Cloneable, Serializable
A text annotation that can be placed at a particular (x, y) location on an XYPlot.
See Also:
Serialized Form
  • Constructor Details

    • 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).
      Parameters:
      text - the text.
      x - the x-coordinate.
      y - the y-coordinate.
  • Method Details

    • getX

      public double getX()
      Returns the x coordinate for the text anchor point (measured against the domain axis).
      Returns:
      The x coordinate.
    • setX

      public void setX​(double x)
      Sets the x coordinate for the text anchor point (measured against the domain axis).
      Parameters:
      x - the x coordinate.
    • getY

      public double getY()
      Returns the y coordinate for the text anchor point (measured against the range axis).
      Returns:
      The y coordinate.
    • setY

      public void setY​(double y)
      Sets the y coordinate for the text anchor point (measured against the range axis).
      Parameters:
      y - the y coordinate.
    • draw

      public void draw​(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis)
      Draws the annotation.
      Specified by:
      draw in interface XYAnnotation
      Parameters:
      g2 - the graphics device.
      plot - the plot.
      dataArea - the data area.
      domainAxis - the domain axis.
      rangeAxis - the range axis.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of the annotation.
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - if the annotation can't be cloned.