Class ColorRange

java.lang.Object
com.motivewave.platform.sdk.draw.Figure
com.motivewave.platform.sdk.draw.ColorRange

public class ColorRange extends Figure
This class may be used to draw a set of colors at a given bar location. Each color is defined by a region. The region consists of a color plus top and bottom values. The width of the color range will be the bar width of the graph. A background color may be specified to fill areas where no color has been defined.
  • Constructor Details

    • ColorRange

      public ColorRange(long time)
      Creates a color range at the given bar time.
      Parameters:
      time - milliseconds since 1970
  • Method Details

    • layout

      public void layout(DrawContext ctx)
      Converts the color regions to displayable areas on the graph.
      Overrides:
      layout in class Figure
      Parameters:
      ctx - draw context
    • draw

      public void draw(Graphics2D gc, DrawContext ctx)
      This method draws the figure on the graph (using the given Graphics2D). This method is called by the study framework to display the figure on the graph.
      Overrides:
      draw in class Figure
      Parameters:
      gc - graphics context
      ctx - draw context
    • addRegion

      public void addRegion(Color color, double bottom, double top)
      Adds a color region to this range. The top and bottom values are 'real' values and will be converted to graph values in the 'layout' method.
      Parameters:
      color - Color for the region
      bottom - 'real' bottom value
      top - 'real' top value
    • clearRegions

      public void clearRegions()
      Removes all of the regions defined for this color range.
    • setBackgroundColor

      public void setBackgroundColor(Color bg)
      Sets the background color for the color range. this is the color that is shown for undefined regions.
      Parameters:
      bg - background color
    • getBackgroundColor

      public Color getBackgroundColor()
      Gets the background color for the color range. this is the color that is shown for undefined regions.
      Returns:
      background color for the color range.
    • getTime

      public long getTime()
      Gets the time (in milliseconds since 1970) where this bar is displayed.
      Returns:
      time where this bar is displayed