Class CategoryTextAnnotation

All Implemented Interfaces:
Serializable, Cloneable, Annotation, CategoryAnnotation, PublicCloneable
Direct Known Subclasses:
CategoryPointerAnnotation

public class CategoryTextAnnotation extends TextAnnotation implements CategoryAnnotation, Cloneable, PublicCloneable, Serializable
A text annotation that can be placed on a CategoryPlot.
See Also:
  • Field Details

    • serialVersionUID

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

      private Comparable category
      The category.
    • categoryAnchor

      private CategoryAnchor categoryAnchor
      The category anchor (START, MIDDLE, or END).
    • value

      private double value
      The value.
  • Constructor Details

    • CategoryTextAnnotation

      public CategoryTextAnnotation(String text, Comparable category, double value)
      Creates a new annotation to be displayed at the given location.
      Parameters:
      text - the text (null not permitted).
      category - the category (null not permitted).
      value - the value.
  • Method Details

    • getCategory

      public Comparable getCategory()
      Returns the category.
      Returns:
      The category (never null).
      See Also:
    • setCategory

      public void setCategory(Comparable category)
      Sets the category that the annotation attaches to and sends an AnnotationChangeEvent to all registered listeners.
      Parameters:
      category - the category (null not permitted).
      See Also:
    • getCategoryAnchor

      public CategoryAnchor getCategoryAnchor()
      Returns the category anchor point.
      Returns:
      The category anchor point.
      See Also:
    • setCategoryAnchor

      public void setCategoryAnchor(CategoryAnchor anchor)
      Sets the category anchor point and sends an AnnotationChangeEvent to all registered listeners.
      Parameters:
      anchor - the anchor point (null not permitted).
      See Also:
    • getValue

      public double getValue()
      Returns the value that the annotation attaches to.
      Returns:
      The value.
      See Also:
    • setValue

      public void setValue(double value)
      Sets the value and sends an AnnotationChangeEvent to all registered listeners.
      Parameters:
      value - the value.
      See Also:
    • draw

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

      public boolean equals(Object obj)
      Tests this object for equality with another.
      Overrides:
      equals in class TextAnnotation
      Parameters:
      obj - the object (null permitted).
      Returns:
      true or false.
    • canEqual

      public boolean canEqual(Object other)
      Ensures symmetry between super/subclass implementations of equals. For more detail, see http://jqno.nl/equalsverifier/manual/inheritance.
      Overrides:
      canEqual in class TextAnnotation
      Parameters:
      other - Object
      Returns:
      true ONLY if the parameter is THIS class type
    • hashCode

      public int hashCode()
      Returns a hash code for this instance.
      Overrides:
      hashCode in class TextAnnotation
      Returns:
      A hash code.
    • clone

      public Object clone() throws CloneNotSupportedException
      Returns a clone of the annotation.
      Specified by:
      clone in interface PublicCloneable
      Overrides:
      clone in class AbstractAnnotation
      Returns:
      A clone.
      Throws:
      CloneNotSupportedException - this class will not throw this exception, but subclasses (if any) might.