CAPDM Tutorial Applets

Moving Average

Functionality:

This applet allows comparison of plotted data with the Moving Average method and shows the results of applying the moving average technique to a variety of data sets. The number of points used in the moving average can be changed bu the student.

Remote Control using JavaScript

A few static data sets can be called on and viewed, but random data sets can also be created to show a wider range of behaviours. See the 'Runtime Applet API Calls' section below for details.

Examples

Show the M14T5 data

Show the Mclune (M14CS3) data

Show a randomly generated series

Show 'About' dialog

How to Invoke the Applet

The applet can be invoked by embedding an APPLET tag into your HTML document (if you look at the source of this document you will see a working example you can copy). The table below details the basic parameters used and additional startup parameters that are specific to this applet.

<APPLET
   CODEBASE="../../../../classes"
   CODE="applet.capdm.qm.movingaverage.MovingAverageApp" 
NAME="MovingAverage" ALT="Moving Average" WIDTH="360" HEIGHT="425"> <param name="DataFile" value="data/capdm/qm/movingaverage/movingavg.data"> </APPLET>
Basic Parameters Use
CODEBASE="../../../../classes" The CODEBASE of the applet must point at the top-level classes directory in order for the applet to be found.
CODE="applet.capdm.qm.movingaverage.
MovingAverageApp"
This required attribute gives the name of the file that contains the applet's compiled Applet subclass. This file is relative to the base URI of the applet.
ALT="Moving Average" This optional attribute specifies any text that should be displayed if the browser understands the APPLET tag but can't run Java applets.
NAME="MovingAverage" This optional attribute specifies a name for the applet instance, which makes it possible for applets on the same page to find (and communicate with) each other. If you intend to use JavaScript/Applet scripting then the applet must be named a shown.
WIDTH="360" HEIGHT="425" These required attributes give the initial width and height (in pixels) of the applet display area, not counting any windows or dialogs that the applet brings up.
Applet Startup Parameters Use
<param name="DataFile" value="data/capdm/qm/movingaverage/movingavg.data"> Contains the data used in the static data sets made available to the applet.

For more information on the use of the APPLET tag and other attributes you can use but which are not listed above, visit the W3.org specification page at: APPLET tag in HTML 4.

Runtime Applet API Calls

This applet can be called into using Javascript 1.1 while running. Although JavaScript can call the Applet directly, some convenient JavaScript functions have been created which deal with the details of the communication. The following table lists the call Names which can be made, and gives examples of their use and results.

API Call Name Parameters Use and Result
showShort none javascript:showShort(); shows the M14T5 set of data
showLong none javascript:showLong(); shows the M14CS3 set of data (McLune)
showRandom none javascript:showRandom(); creates a random, yet realistic set of data for experimentation
showAbout none javascript:showAbout(); Shows the version dialog box of this applet.