Class XYInversePointerAnnotation

All Implemented Interfaces:
Serializable, Cloneable, Annotation, XYAnnotation, PublicCloneable

public class XYInversePointerAnnotation extends XYPointerAnnotation implements Cloneable, PublicCloneable, Serializable
An arrow and label that can be placed on an XYPlot. The arrow is drawn at a user-definable angle but points towards the label of 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.

See Also:
  • Field Details

    • serialVersionUID

      private static final long serialVersionUID
      For serialization.
      See Also:
    • DEFAULT_DOT_RADIUS

      public static final double DEFAULT_DOT_RADIUS
      The default dot radius (in Java2D units).
      See Also:
    • dotRadius

      private double dotRadius
      The radius of the dot at the start of the arrow.
  • Constructor Details

    • XYInversePointerAnnotation

      public XYInversePointerAnnotation(String label, double x, double y, double angle)
      Creates a new label and arrow annotation.
      Parameters:
      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).
  • Method Details

    • getDotRadius

      public double getDotRadius()
      Returns the radius of the dot at the start of the arrow.
      Returns:
      the radius of the dot at the start of the arrow
      See Also:
    • setDotRadius

      public void setDotRadius(double dotRadius)
      Sets the radius of the dot at the start of the arrow, ≤ 0 will omit the dot.
      Parameters:
      dotRadius - the radius of the dot at the start of the arrow
      See Also:
    • draw

      public void draw(Graphics2D g2, XYPlot plot, Rectangle2D dataArea, ValueAxis domainAxis, ValueAxis rangeAxis, int rendererIndex, PlotRenderingInfo info)
      Draws the annotation.
      Specified by:
      draw in interface XYAnnotation
      Overrides:
      draw in class XYPointerAnnotation
      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 - the plot rendering info.
    • hashCode

      public int hashCode()
      Description copied from class: XYPointerAnnotation
      Returns a hash code for this instance.
      Overrides:
      hashCode in class XYPointerAnnotation
      Returns:
      A hash code.
    • equals

      public boolean equals(Object obj)
      Description copied from class: XYPointerAnnotation
      Tests this annotation for equality with an arbitrary object.
      Overrides:
      equals in class XYPointerAnnotation
      Parameters:
      obj - the object (null permitted).
      Returns:
      true or false.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of the annotation.
      Specified by:
      clone in interface PublicCloneable
      Overrides:
      clone in class XYPointerAnnotation
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - if the annotation can't be cloned.