Class Graph

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.

Variable Index

 o graphHeight
 o graphWidth

Constructor Index

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

Method Index

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

Variables

 o graphWidth
  public final int graphWidth
 o graphHeight
  public final int graphHeight

Constructors

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

Methods

 o 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
 o 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
 o clearGraphData
  public void clearGraphData()
This method deletes the old graph data
 o 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
 o 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
 o 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
 o 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
 o backgroundPaint
  public void backgroundPaint(Graphics g)
This method is actually in charge of calling each of the drawing methods.
Parameters:
g - the graphics context
 o 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
 o getImage
  public Image getImage()
This method returns the offscreen image for creating the GIF file.