The applet is embedded in a html document in the following way:
<applet codebase=../classes/ code=GraphApplet.class width=260 height=260>
<param name=function1 value="3*x^2">
codebase represents the location of GraphApplet.class relative to the calling document.
width and height specify the width and height in pixels of the resulting graph.
The applet has the following interactive features:
- zooming When the applet has focus (by clicking in the applet window with the mouse) it is possible to zoom in and out by pressing "z" (lower case) or "Z" (upper case).
- resetting Press "r"
- tracing When the mouse is dragged over the applet window the current (x,y) coordinates are displayed on the status line
- help By pressing 'h" a help screen shows for about 8 seconds
<Param name=speed value=positive integer>
The speed parameter tells GraphApplet how much pixels to the right it should advance to calculate the next point of the graph; when omitted the default value 4 is taken.
When plotting very smooth curves a higher value can be chosen. When necessary the minimum speed of 1 can be chosen, e.g. when plotting functions like y=sqrt(x) or functions with discontinuities
<Param name=labels value=yes/no>
When set to 'yes' a label is constructed from the functionstring. This label is displayed when a text-string for this function is absent. The default value is 'no'
<Param name=grid value=yes/no>
When set to 'yes' a grid is shown. Default value is 'no'
<Param name=help value=yes/no>
When set to 'yes' the help-screen is shown when calculating the graph for the first time. The help-screen remains available by pressing the help button. Default value is 'yes'
<Param name=maxx value=positive integer>
Sets the maximum value of x. The minimum value is automatically -maxx. The default value is 10.
<Param name=maxy value=positive integer>
Sets the maximum value of y. The minimum value is automatically -maxy. The default value is 10.
<Param name=functioni value=function string [;parameterlist]>
Up to five functions can be plotted in one graph; they are numbered function0, function1...function4. Only one of these five need be present. The functions are plotted according to the following color scheme: function0: black; function1: red; function2: blue; function3 : magenta; function4: green.
A full example of a function is:
<Param name=function0 value="a*x^2+b;a=1,2;b=1,2,3>
- The function string can be:
- a string to be evaluated by the built in string evaluator. See Eval for details.
When uGraphApplet is used instead of GraphApplet this results in an error message. uGraphApplet is designed for people that use only user defined functions. The advantage is that uGraphApplet does not try to load Eval. This results in faster loading when used over the web
- the string user. A user defined function in the class user is plotted
- the string user: followed by something to define which function is meant; the part between user: and the optional parameterlist or, when a parameterlist is not present, the part after user: is presented to one of the methods of the class user which should be present in the same directory as GraphApplet. See also Faster Plotting
- The optional parameterlist lists all the parameters that occur in the function separated by semicolons (;) and gives the possible values separated by comma's (,).
An example of a parameterlist is a=1,2;b=1,2,3.
All possible combinations of the values of a and b are plotted separately. See also Families of functions
<Param name=texti value=text>
When present it overrides the label constructed from the function string. Is shown whatever the state of the parameter labels.
<Param name=points value=[text],x(double),y(double),pos(1..9),color(0..4)[;........]>
So pos=3 draws the text north-east of the dot.
At position 5 no dot is drawn but only the text;
Makes it possible to display a dot and a text at a chosen position in the plane.
x and y govern the position of the dot that is drawn;
pos governs the position of the text with respect to the dot, according to the following scheme:
To display a dot without text, omit the text but don't forget the comma: so
value=",1,2,7,1" will display a dot at position (1,2) on the screen with color 1;
The colors available are the same as the colors functions are drawn with:
0:black; 1:red; 2:blue 3:magenta 4:green
As many points can be drawn as wanted by separating them with semicolons (;).
Because the syntax of this parameter is somewhat tricky in case of an error a reminder is shown on the status line.