Open source cross-platform software of geometry, analysis and simulation - Yves Biton

# Using MathGraph32 Applet : Example 1

publication Monday 31 January 2011.

Our purpose:

MathGraph32 applet allows the user to display dynamical figures on web pages.

We wiil show here how to create a basic web page displaying a MathGraph32 figure.

Once the figure displayed in a web page, it is possible to interact with this figure by capturing a moveable point or excuting a macro.

Required configuration

MathGraph32 applet needs java virtual machine to be installed, version 1.5 or later.

We will also assume that you know how to upload files on a distant server.
For instance you can use for this purpose a software like filezilla.

We will use a basic text editor but you can also use an html editor.

Implementation

Create a directory on your disk we will call RepExample1.

Download the last version of MathGraph32 java applet on this page. Save this jar file in RepExample1 and if necessary rename it AppletMathGraph32.jar.

Create a figure of your choice with MathGraph32 and save it as
Fig1.mgj in the directory RepExample1.

Type the following lines :

<html> <head> <title></title> </head> <body> <br> </body> </html>

Now we have to insert the html code necessary to display the figure via MathGraph32 applet.

In the dialog box popping up, click on button Copy code to clipboard then click on the Close button.

We have now the following code :

<html> <head> <title></title> </head> <body> <br> <APPLET CODE="Applet.AppletMathGraph32.class"    ARCHIVE = "AppletMathGraph32.jar"    WIDTH=621    HEIGHT=392>    <PARAM NAME= Path VALUE = "Fig1.mgj"> </APPLET> </body> </html>

Save your text file as index.htm in the directory RepExample1.

Internet online disposal

Now you need to upload the containing of the directory RepExample1 on your website in a same directory.

The figure underneath is displayed in the same way.

Clicking on button Animation (macro) will launch an animation in this figure.

You can also capture point O and A.

How to get a figure moving permanently in a webpage

For this, your figure must contain an animation macro and this macro must be chosen as default animation macro in MathGraph32 via menu item Otpions - Current Figure - Default animation macro.

Reopen the figure Fig1.mgj, create the animation macro named Animation and set it the default animation macro as told before.
<APPLET CODE="Applet.AppletMathGraph32.class"    ARCHIVE = "AppletMathGraph32.jar"    WIDTH=621    HEIGHT=392>    <PARAM NAME= Path VALUE = "Fig2.mgj"> </APPLET>