graph chart

2D / 3D Area Graph Examples

[ Graph Home ] [ Documentation ] [ Getting Started ] [ Solutions ]

Applet Example 7 - JavaScript Interaction

if you do not see the graph below then click here

click on the points to see the data tables

 

 

This examples demonstrates how the applet is able to interact with JavaScript functions within the current page. In the graph below clicking on the Data Points will execute a JavaScript function which will either show or hide a table of data for that series.

and here is the HTML code for the applet
(note that 'mayscript' has been added to the APPLET tag ),

<applet code="AreaGraphApplet.class" archive="AreaGraph.jar" width="460" height="440" mayscript>

<!-- Start Up Parameters -->
<PARAM name="LOADINGMESSAGE" value="Line Graph Loading - Please Wait."> <!-- Message to be displayed on Startup -->
<PARAM name="STEXTCOLOR" value="0,0,100"> <!-- Message Text Color-->
<PARAM name="STARTUPCOLOR" value="255,255,255"> <!-- Applet Background color -->

<!-- Data files -->
<PARAM NAME="chartproperties" VALUE="areapropsjs.txt">
<PARAM NAME="chartdata" VALUE="areadatajs.txt">

</applet>

 

The configuration parameters are taken from the text file areapropsjs.txt ( click here to view )
and the graph data is read from the text file areadatajs.txt ( click here to view )

If you "right click" and view source of this page you will see that we have the following JavaScript function within the page which is able to act upon the three tables, "c1", "c2" and "c3".

<SCRIPT LANGUAGE="javascript">

var table='c1';
function combo(table) {

if (table=='c1') {
if (document.all.c1.style.visibility=="hidden") {
document.all.c1.style.visibility="visible";
}
else {document.all.c1.style.visibility="hidden";}
}

if (table=='c2') {
if (document.all.c2.style.visibility=="hidden") {
document.all.c2.style.visibility="visible";
}
else {document.all.c2.style.visibility="hidden";}
}

if (table=='c3') {
if (document.all.c3.style.visibility=="hidden") {
document.all.c3.style.visibility="visible";
}
else {document.all.c3.style.visibility="hidden";}
}

}

</script>

In the areadatajs.txt ( click here to view ) file you will see that each of our data elements has the word "javascript" entered in the target field and the JavaScript function name with the relevant value entered in the URL field.

For a full explanation of and range of values for the above parameters please see the Documentation - Configuration Options».

« back to Examples Index

« back to Getting Started

[ Graph Home ] [ Documentation ] [ Getting Started ] [ Solutions ]

Getting Started

Documentation

Examples

Common Problems
This section describes and provides solutions to common problems.