plot = new WavePlot( 25, 30, 400, 300 );
plot.setServer( "http://vrml.boulder.vni.com.:9000" );
or
plot.setLocalServer("C:\\jwave\\waveserver");
(Note that a double backslash is needed to place a backslash
in a string object in Java)
The setServer() method specifies the URL of the server which has a "waveserver" script in its cgi-bin directory. Communications with the PV-WAVE graphic server is performed through this CGI script.
The setLocalServer() method specifies a local directory which a PV-WAVE process running the "LocalServer" procedure uses to communicate with the applet via files.
plot.reset(); // Reset all attributes
plot.setTitle( "WavePlot Test" ); // Set the title
plot.setXTitle( "X Axes" ); // Set axes titles
plot.setYTitle( "Y Axes" );
plot.TEK_COLOR(); // Use the 32 Tectronix colors
plot.setBackground("blue"); // Set background color
plot.setColor( 3 ); // Set plot color
plot.setLinestyle( 2 ); // Set line style
Keep in mind that PV-WAVE is using a 256 color palette and all of
its color handling functions apply, and that colors are specified
by an index into this palette (although some JWAVE methods are
overloaded to also accept the standard java color names).
You can call methods like LOADCT() and TEK_COLOR() to change
Wave's color palette.
double[] data = new double[200];
for(int i =0; i<200; i++) data[i]=Math.sin(i*0.1);
plot.setY( data );
Methods like setY() are overloaded to accept data of type int,
float, double, Vector, and even String (where the data is assumed to
be tab separated numbers).
The setZ() method is also overloaded to accept a variable followed by two integers which define a two dimensional grid represented by the data. This is required for Surface and Contour plots.
An important point to remember is that calling methods like setY() does NOT create a new copy of your data, but just a reference to it (i.e. using the assignment operator "=" in Java). Thus be careful not to change the data between the setY() method call and the plot() method call, as the data sent to PV-WAVE will be affected.
plot.plot();
This causes PV-WAVE to be contacted, the plot produced, and the plot
displayed in your applet/application. In the case of a VRML world,
as with the Wave VRMLSurface() class, a new instance of your browser
is invoked and the VRML world displayed in it.
Please refer to the JWAVE Reference Documentation for specific API information. See the Simple Example for a minimal applet using the WavePlot() class, or refer to the JWAVE Examples for examples of using all of the JWAVE components in more complicated interfaces.