Class SinglePointFigure

java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.SinglePointFigure
Direct Known Subclasses:
Label, Marker

public class SinglePointFigure extends Figure
Instances of this class represent objects that are anchored by a single point. These object may either be positioned absolutely (by a specific time and value) or relative to a price bar (top or bottom). When positioned relatively other figures that are at the same location will be stacked vertically.
  • Constructor Details

    • SinglePointFigure

      public SinglePointFigure()
  • Method Details

    • contains

      public boolean contains(double x, double y, DrawContext ctx)
      This method is called by the study framework to determine if the figure contains the x and y coordinates. This implementation considers the use of the relative location to determine if the figure contains x and y.
      Overrides:
      contains in class Figure
      Returns:
      true if this figure contains the (x,y) coordinates.
    • isVisible

      public boolean isVisible(DrawContext ctx)
      This method is called by the study framework and is used to improve the performance of the study by only working figures that are currently visible.
      Overrides:
      isVisible in class Figure
      Returns:
      true if this figure is visible within the given DrawContext.
    • getLocation

      public Coordinate getLocation()
      Gets the location of this marker.
      Returns:
      the location of this marker.
    • setLocation

      public void setLocation(Coordinate coord)
      Sets the location of the marker.
      Parameters:
      coord - coordinate for the location of the marker
    • setLocation

      public void setLocation(long time, double value)
      Sets the absolute location of this figure.
      Parameters:
      time - time value (in milliseconds)
      value - y axis value
    • getTime

      public long getTime()
      Gets the time location (x coordinate).
      Returns:
      time x coordinate in milliseconds since 1970
    • getValue

      public double getValue()
      Gets the real value location (y coordinate).
      Returns:
      real value (y coordinate)
    • getPosition

      public Enums.Position getPosition()
      Gets the relative position of the figure to its location.
      Returns:
      the relative position of the figure to its location
    • setPosition

      public void setPosition(Enums.Position position)
      Sets the relative position of the marker to its location.
      Parameters:
      position - position of the marker
    • setStackPolicy

      public void setStackPolicy(Enums.StackPolicy stackPolicy)
      Sets the policy for stacking figures that share the same coordinates (above or below).
      Parameters:
      stackPolicy -
    • getStackPolicy

      public Enums.StackPolicy getStackPolicy()
      Sets the policy for stacking figures that share the same coordinates (above or below).
      Returns:
      the policy for stacking figures that share the same coordinates.
    • setGraphLocation

      public void setGraphLocation(Point2D location)
      Sets the location where this figure will be drawn on the graph. This location will be the translated version of the real location (Coordinate) unless the figure is stacked (see stack policy). This is called by the study framework.
      Parameters:
      location -
    • getGraphLocation

      public Point2D getGraphLocation()
      Gets the location where this figure will be drawn on the graph. This location will be the translated version of the real location (Coordinate) unless the figure is stacked (see stack policy).
      Returns:
      graph location of this figure
    • setOffsetPixels

      public void setOffsetPixels(int pixels)
      Sets the offset in pixels to display the figure from the location. The direction of this offset will depend on the position.
      Parameters:
      pixels - offset in pixels
    • getOffsetPixels

      public int getOffsetPixels()
      Gets the offset in pixels to display the figure from the location. The direction of this offset will depend on the position.
      Returns:
      offset in pixels