# Class Graph

    java.lang.Object
       |
       +----java.awt.Component
               |
               +----java.awt.Canvas
                       |
                       +----Graph

public class Graph
extends Canvas

This class is responsible for drawing and refreshing the graph.

##

graphHeight
graphWidth

##

Graph()
  The constructor method creates storage for data for each of the curves, initializes some variables, and resizes the graph.

##

backgroundPaint(Graphics)
  This method is actually in charge of calling each of the drawing methods.
clearGraphData()
  This method deletes the old graph data
drawPoint(Graphics, int, int)
  This method draws a small diamond at the specified point
drawTicks(Graphics, Vector, String)
  This method draws the y-axis tick marks and labelling them
getImage()
  This method returns the offscreen image for creating the GIF file.
paint(Graphics)
  This method attempts to create an off screen image and then calls the background paint method.
setGraphData(Vector, Vector)
  This method assigns new data to the curve vectors
setLineStyle(String)
  This method is used to update the line style selected by the user.
updateScale(String)
  This method is called by external classes to update the scale selection.
updateUserScale(String, double)
  This method allows external classes to update the manual scale mechanisms.

##

graphWidth

      public final int graphWidth

graphHeight

      public final int graphHeight

##

Graph

      public Graph()

  The constructor method creates storage for data for each of the curves, initializes some variables, and resizes the graph.

##

updateScale

      public void updateScale(String s)

  This method is called by external classes to update the scale selection.
  Parameters:
    s - string parameter containing either RED, BLUE, or INDEPENDENT
  See Also:
    lilgpMonitor

updateUserScale

      public void updateUserScale(String which,
                                  double s)

  This method allows external classes to update the manual scale mechanisms.
  Parameters:
    which - is used to determine which scale to adjust either RED or BLUE
    s - is the scale value
  See Also:
    lilgpMonitor

clearGraphData

      public void clearGraphData()

  This method deletes the old graph data

setGraphData

      public void setGraphData(Vector metricOne,
                               Vector metricTwo)

  This method assigns new data to the curve vectors
  Parameters:
    metricOne - specifies the data for the red curve
    metricTwo - specifies the data for the blue curve

setLineStyle

      public void setLineStyle(String style)

  This method is used to update the line style selected by the user.
  Parameters:
    style - specifes the line style, either LINES or LINESPOINTS

drawTicks

      public void drawTicks(Graphics g,
                            Vector theData,
                            String anchor)

  This method draws the y-axis tick marks and labelling them
  Parameters:
    g - the graphics context
    theData - current curve data
    anchor - specifies which axis to draw the ticks on, either EAST or WEST

drawPoint

      public void drawPoint(Graphics g,
                            int x,
                            int y)

  This method draws a small diamond at the specified point
  Parameters:
    g - the graphics context
    x - the x coordinate of the data point
    y - the y coordinate of the data point

backgroundPaint

      public void backgroundPaint(Graphics g)

  This method is actually in charge of calling each of the drawing methods.
  Parameters:
    g - the graphics context

paint

      public void paint(Graphics g)

  This method attempts to create an off screen image and then calls the background paint method. If it fails, then it simply paints on the visible graphics context.
  Parameters:
    g - the graphics context
  Overrides:
    paint in class Canvas

getImage

      public Image getImage()

  This method returns the offscreen image for creating the GIF file.