All Packages Class Hierarchy This Package Previous Next Index
java.lang.Object | +----java.awt.Component | +----java.awt.Canvas | +----crw.data2.PlotCanvas2
(1) create a GraphSet object. (2) specify axis property: (i) set the begining and ending coordinates and location on Canvas. (ii) set the values at begining and ending coordinates. (3) call the GraphSet.init() method. This calculates the conversion factors for data values to the x-axis and y-axis scales. (4) instantiate and add Data objects to GraphSet by add(Data2). (5) add GraphSet object to PlotCanvas2 object. (6) add any other GraphSet objects to canvas. (7) finally, add the PlotCanvas2 object to applet or application. In summary, new GraphSet() => GraphSet.getAxisX().setXXXs() => GraphSet.init() => PlotCanvas2.add(GraphSet) => => Applet.add(PlotCanvas2). In many applications, the axes may be tied to an external reference for the coordinates on Canvas. This can be set using Axis2.setAxisCoordinateRef(AxisCoordinateRef) and specifying the needed info. For example, //(1) GraphSet graph = new GraphSet(); //(2) AxisX x = graph.getAxisX(); x.setLocation(100); // y-coordinate on Canvas x.setBegin(150); //beginning x-coordinate x.setEnd(50); //ending x-coordinate on canvas x.setVBegin(0.24); //Value at begin x.setVEnd(3.57); //value at end AxisY y = graph.getAxisY(); y.setLocation(200); //x-coordinate y.setBegin(170);//beginning y-coordinate y.setEnd(20); //ending y-coordinate y.setVBegin(1E12); //value at begin y.setVEnd(1E16); //value at end //(3) graph.init(); //initializes the conversion factors //(4) graph.add(new MyFunctionData() ); //(5) PlotCanvas2 canvas = new PlotCanvas2(); canvas.add(graph); //(6) add any other graphs //(7) MyApplet applet = new MyApplet(); applet.add(canvas);
![]()
public PlotCanvas2()
public void add(GraphSet graph)
public void update(Graphics g)
public void paint(Graphics g)
All Packages Class Hierarchy This Package Previous Next Index