Logiciel libre de géométrie, d'analyse et de simulation multiplateforme par Yves Biton
 
Accueil - L’applet MathGraph32 et l’export html

Using MathGraph32 Applet : Example 1

publication lundi 31 janvier 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 you have installed the last version of MathGraph32 java . You can download this version on this page.

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.

Now start your text editor.

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.

Return to MathGraph32 and use menu Help - html code for applet.

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

Return to your text editor and copy the clipboard content above the line .

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.
Save it as Fig2.mgj and upload this page to your internet server.

Enter the following code into your text editor :

<APPLET CODE="Applet.AppletMathGraph32.class"
   ARCHIVE = "AppletMathGraph32.jar"
   WIDTH=621
   HEIGHT=392>
   <PARAM NAME= Path VALUE = "Fig2.mgj">
</APPLET>

Your figure will be continuously animated as underneath :

Notice than you can even capture and move point O while the animation is going on.