All Packages Class Hierarchy This Package Previous Next Index
Class ChaosDemos.superGraph2D
java.lang.Object

+java.awt.Component

+java.awt.Canvas

+graph.Graph2D

+ChaosDemos.superGraph2D
 public class superGraph2D
 extends Graph2D
Class to make and modify 2D graph
Subclass of Graph2D by Leigh Brookshaw
Maximum number of curves is 10
 Version:
 15 March 1997
 Author:
 Michael Cross

allowDrag


xaxis
 The xaxis of the graph

yaxis
 The yaxis of the graph

superGraph2D()
 Default Constructor

superGraph2D(double, double, double, double)
 Constructor givin minimum and maximum coordinates
(can be rescaled later)

superGraph2D(dynamicGraph)
 Constructor given dynamicGraph parent

addCurve(double[], int, Color)
 Adds an additional curve to be plotted
Returns index number of curve.

addCurve(double[], int, Color, int, int, double)
 Adds an additional curve to be plotted
Returns index number of curve.

appendToCurve(double[], int, int)
 Adds npts from indata[] to curve n

deleteAllCurves()
 Deletes all curves

deleteFromCurve(int)


deleteFromCurve(int, int)
 Deletes points from BEGINNING of curve

getData(int, int)
 Returns first np points in curve n

mouseDown(Event, int, int)
 Respond to mouse click in graph
calls respondToMouse(xcoord, xcoordValid, ycoord, ycoordValid)
with (xcoord,ycoord) the coordinates of the event (in units of the
axes) and xcoordValid true if coordinate within range of axis etc.

mouseDrag(Event, int, int)


mouseUp(Event, int, int)


nPoints(int)
 Returns number of points in curve n

paintBeforeData(Graphics, Rectangle)
 Connects to addToGraph method in parent.

paintFirst(Graphics, Rectangle)
 Interface to Graph2D that is called before cruves are drawn in paint

setTitle(String)
 Sets title string

setXAxisTitle(String)
 Sets xaxis title

setYAxisTitle(String)
 Sets yaxis title

update(Graphics)
 This method is called through the repaint() method.
xaxis
public Axis xaxis
 The xaxis of the graph
yaxis
public Axis yaxis
 The yaxis of the graph
allowDrag
public boolean allowDrag
superGraph2D
public superGraph2D()
 Default Constructor
superGraph2D
public superGraph2D(dynamicGraph target)
 Constructor given dynamicGraph parent
 Parameters:
 target  parent of type dynamicGraph
superGraph2D
public superGraph2D(double xmin,
double ymin,
double xmax,
double ymax)
 Constructor givin minimum and maximum coordinates
(can be rescaled later)
 Parameters:
 xmin  minimum value of x
 xmax  maximum value of x
 ymin  minimum value of y
 ymax  maximum value of y
addCurve
public int addCurve(double indata[],
int n,
Color c)
 Adds an additional curve to be plotted
Returns index number of curve.
 Parameters:
 indata  data to be plotted indata[0][2n1]
 n  data points used are indata[0][2n1]
 c  color of new curve
 Returns:
 index number of curves
addCurve
public int addCurve(double indata[],
int n,
Color c,
int linestyle,
int marker,
double markerscale)
 Adds an additional curve to be plotted
Returns index number of curve.
 Parameters:
 indata  data to be plotted indata[0][2n1]
 n  data points used are indata[0][2n1]
 c  color of new curve
 linestyle  0 for points, 1 for line
 Returns:
 index number of added curve
appendToCurve
public void appendToCurve(double indata[],
int npt,
int n)
 Adds npts from indata[] to curve n
 Parameters:
 indata[]  data to add from
 npt  nunmer of points to add
 n  index of curve to add to
deleteFromCurve
public void deleteFromCurve(int npt,
int n)
 Deletes points from BEGINNING of curve
 Parameters:
 npt  number of points to delete
 n  curve to delete from
deleteFromCurve
public void deleteFromCurve(int n)
nPoints
public int nPoints(int n)
 Returns number of points in curve n
 Parameters:
 n  index of curve
 Returns:
 number of points in curve
getData
public double[] getData(int n,
int np)
 Returns first np points in curve n
 Parameters:
 n  index of curve
 np  number of points to return (must be less than number in curve)
 Returns:
 array of points in x,y pairs
deleteAllCurves
public int deleteAllCurves()
 Deletes all curves
 Returns:
 1 (for number of curves)
paintFirst
public void paintFirst(Graphics g,
Rectangle r)
 Interface to Graph2D that is called before cruves are drawn in paint
 Parameters:
 g  reference to Graphics object
 r  reference to Rectangle object
 Overrides:
 paintFirst in class Graph2D
setTitle
public void setTitle(String intitle)
 Sets title string
 Parameters:
 intitle  text for title
mouseDown
public boolean mouseDown(Event evt,
int x,
int y)
 Respond to mouse click in graph
calls respondToMouse(xcoord, xcoordValid, ycoord, ycoordValid)
with (xcoord,ycoord) the coordinates of the event (in units of the
axes) and xcoordValid true if coordinate within range of axis etc.
 Overrides:
 mouseDown in class Component
mouseUp
public boolean mouseUp(Event e,
int x,
int y)
 Overrides:
 mouseUp in class Component
mouseDrag
public boolean mouseDrag(Event e,
int x,
int y)
 Overrides:
 mouseDrag in class Component
paintBeforeData
public void paintBeforeData(Graphics g,
Rectangle r)
 Connects to addToGraph method in parent. Called by the paint method in Graph2D
 Parameters:
 g  graphics
 r  data rectangle
 Overrides:
 paintBeforeData in class Graph2D
setXAxisTitle
public void setXAxisTitle(String title)
 Sets xaxis title
 Parameters:
 title  text for xaxis title
setYAxisTitle
public void setYAxisTitle(String title)
 Sets yaxis title
 Parameters:
 title  text for yaxis title
update
public void update(Graphics g)
 This method is called through the repaint() method.
 Overrides:
 update in class Graph2D
All Packages Class Hierarchy This Package Previous Next Index