Class ChartAnnotation

All Implemented Interfaces:
PropertyChangeListener, EventListener, org.jfree.chart.annotations.Annotation, org.jfree.chart.annotations.XYAnnotation, Sharable
Direct Known Subclasses:
RangeFilter, TrackSegment, WayPoint

public abstract class ChartAnnotation extends PropertiedThing implements org.jfree.chart.annotations.XYAnnotation
Class ChartAnnotation is an abstract class for the annotations on charts
Version:
$Revision: 1.20 $
Author:
IDV Development Team
  • Field Details

    • COLOR_SELECTED

      public static final Color COLOR_SELECTED
      Selected color
    • x

      protected int x
      x location. Though not all annotations have a single x/y
    • y

      protected int y
      y location. Though not all annotations have a single x/y
    • transform

      protected AffineTransform transform
      The transform from the last draw
  • Constructor Details

    • ChartAnnotation

      public ChartAnnotation()
      Default ctor
    • ChartAnnotation

      public ChartAnnotation(PlotWrapper plotWrapper)
      Ctro
      Parameters:
      plotWrapper - The chart we are in
  • Method Details

    • formatValue

      public String formatValue(double v)
      tuility
      Parameters:
      v - value
      Returns:
      formatted value
    • getToolTipText

      public String getToolTipText()
      Hook for tooltip
      Returns:
      Tooltip text for this annotation
    • setGraphicsState

      protected void setGraphicsState(Graphics2D g2)
      Called by base classes when drawn. We set the transform here
      Parameters:
      g2 - The graphics
    • distance

      public double distance(int x, int y)
      Distance to the given point. This transforms our x/y to the display space.
      Parameters:
      x - Mouse x
      y - Mouse y
      Returns:
      Distance to x/y
    • distance

      public static double distance(int x1, int y1, int x2, int y2)
      utility method to calculate distance
      Parameters:
      x1 - x1
      y1 - y1
      x2 - x2
      y2 - y2
      Returns:
      distance
    • getTypeName

      public abstract String getTypeName()
      Type of annotation
      Returns:
      Type of annotation
    • applyProperties

      protected boolean applyProperties()
      Apply the properties
      Overrides:
      applyProperties in class PropertiedThing
      Returns:
      success
    • getPropertiesComponents

      protected void getPropertiesComponents(List comps, int tabIdx)
      Collect the components that go into the properties dialog
      Overrides:
      getPropertiesComponents in class PropertiedThing
      Parameters:
      comps - List of left/right components
      tabIdx - Which tab
    • setPosition

      public void setPosition(int x, int y)
      Set the position to the given x/y screen coordinate
      Parameters:
      x - x
      y - y
    • setPosition

      public void setPosition(MouseEvent event)
      Set the position to the x/y of the event
      Parameters:
      event - The event
    • doRemove

      public void doRemove()
      Annotation was removed
    • setSelected

      public void setSelected(boolean value)
      Set the Selected property.
      Parameters:
      value - The new value for Selected
    • getSelected

      public boolean getSelected()
      Get the Selected property.
      Returns:
      The Selected
    • showColorInProperties

      protected boolean showColorInProperties()
      Should the color widget be shown in the properties dialog
      Returns:
      Show color widget
    • setColor

      public void setColor(Color value)
      Set the Color property.
      Parameters:
      value - The new value for Color
    • getColor

      public Color getColor()
      Get the Color property.
      Returns:
      The Color
    • setPlotWrapper

      public void setPlotWrapper(PlotWrapper value)
      Set the PlotWrapper property.
      Parameters:
      value - The new value for PlotWrapper
    • getPlotWrapper

      public PlotWrapper getPlotWrapper()
      Get the PlotWrapper property.
      Returns:
      The PlotWrapper
    • setName

      public void setName(String value)
      Set the Name property.
      Parameters:
      value - The new value for Name
    • getName

      public String getName()
      Get the Name property.
      Returns:
      The Name
    • getY

      public int getY()
      Get the y position
      Returns:
      y
    • getX

      public int getX()
      Get the x position
      Returns:
      x
    • setActive

      public void setActive(boolean value)
      Set the Active property.
      Parameters:
      value - The new value for Active
    • isActive

      public boolean isActive()
      Get the Active property.
      Returns:
      The Active
    • toString

      public String toString()
      tostring
      Overrides:
      toString in class Object
      Returns:
      tostring
    • addPropertyChangeListener

      public void addPropertyChangeListener(PropertyChangeListener listener)
      new property change listener
      Overrides:
      addPropertyChangeListener in class PropertiedThing
      Parameters:
      listener - listener
    • removePropertyChangeListener

      public void removePropertyChangeListener(PropertyChangeListener listener)
      property change listener
      Overrides:
      removePropertyChangeListener in class PropertiedThing
      Parameters:
      listener - listener