Interface DrawContext


public interface DrawContext
Provides an interface to the Graphics environment for drawing figures on the study graph.
  • Method Summary

    Modifier and Type
    Method
    Description
    format​(double value)
    Formats the given value using the formatting properties of the underlying graph/plot.
    int
    Gets the width (in pixels) of the bars.
    Gets the bounds of the graph.
    Gets the data context.
    Gets the environment defaults such as default colors etc.
    Gets the settings of the study (as configured by the user).
    double
    Gets the height of a single tick (instrument's minimum tick) on the graph
    boolean
    Indicates if the study is currently selected by the user.
    translate​(long time, double value)
    Translates a 'real' date and value into a point on the graph.
    Translates a 'real' date and value into a point on the graph.
    long
    translate2Time​(double x)
    Translates the given time into an x coordinate on the graph.
    double
    translate2Value​(double y)
    Translates the given y coordinate to value on the graph (reverse of translateValue).
    int
    translateTime​(long time)
    Translates the given time into an x coordinate on the graph.
    int
    translateValue​(double value)
    Translates the given value into a y coordinate on the graph.
  • Method Details

    • translate

      Point2D translate(long time, double value)
      Translates a 'real' date and value into a point on the graph.
      Parameters:
      time - milliseconds since 1970
      value - real value (y coordinate)
      Returns:
      translated point as a java.awt.Point2D object
    • translate

      Point2D translate(Coordinate coord)
      Translates a 'real' date and value into a point on the graph.
      Parameters:
      coord - real coordinate (time and value)
      Returns:
      translated point as a java.awt.Point2D object
    • translateTime

      int translateTime(long time)
      Translates the given time into an x coordinate on the graph.
      Parameters:
      time - milliseconds since 1970
      Returns:
      x coordinate on the graph
    • translateValue

      int translateValue(double value)
      Translates the given value into a y coordinate on the graph.
      Parameters:
      value - real y coordinate value
      Returns:
      y coordinate on the graph
    • translate2Time

      long translate2Time(double x)
      Translates the given time into an x coordinate on the graph.
      Parameters:
      x - x coordinate on the graph
      Returns:
      translated time milliseconds since 1970
    • translate2Value

      double translate2Value(double y)
      Translates the given y coordinate to value on the graph (reverse of translateValue).
      Parameters:
      y - y coordinate on the graph
      Returns:
      translated real value
    • getBounds

      Rectangle getBounds()
      Gets the bounds of the graph.
      Returns:
      the bounds of the graph as a java.awt.Rectangle
    • getBarWidth

      int getBarWidth()
      Gets the width (in pixels) of the bars.
      Returns:
      bar width in pixels
    • isSelected

      boolean isSelected()
      Indicates if the study is currently selected by the user.
      Returns:
      true if the study is currently 'selected'.
    • getDataContext

      DataContext getDataContext()
      Gets the data context.
      Returns:
      the data context
    • getSettings

      Settings getSettings()
      Gets the settings of the study (as configured by the user).
      Returns:
      study settings.
    • getDefaults

      Defaults getDefaults()
      Gets the environment defaults such as default colors etc.
      Returns:
      environment defaults
    • getTickHeight

      double getTickHeight()
      Gets the height of a single tick (instrument's minimum tick) on the graph
      Returns:
      height of a single tick on the graph
    • format

      String format(double value)
      Formats the given value using the formatting properties of the underlying graph/plot.
      Parameters:
      value - value to be formatted
      Returns:
      value formatted as a string