graph demo

Graphs and Charts Applet Tutorial

graph demo[ Home ] [ Products ] [ Downloads ] [ Purchase ]
[ Support ] [ About Us ]

Embedding the Line Graph Applet within a Dynamic Page

Prerequisites
Graphs and Charts Package - For this tutorial you will need the Advanced Graph and Chart package. If you haven't already done so then you should first download the software here

The Web Server must be capable of running a Scripting Language (eg. ASP, PHP, JSP etc).
Overview
This method provides the ability to add Real-Time Dynamic Database Graphing to your web pages. This method is extremely powerful and allows the construction of graphs from virtually any database system running on virtually any platform.

The idea behind this method is that all the data and configuration information is supplied by to the graph via standard HTML PARAM tags. The values of the PARAM tags may then be dynamically generated by the script in which the graph resides. This means that the script can be written to first read data from a database before populating the PARAM tag values. Hence the result is real-time graphing capability.

Although this tutorial focuses on the Line Graph Applet, this method can be used for any chart style provided in the Advanced Graphs and Charts package (including bar, pie and area graphs).
Method
The graph applet is incorporated into a server side dynamic page script (eg. PHP, ASP, JSP or Perl). Within the script the data values of the Applets PARAM tags are filled in by the Web Server at page view time.

At page view time the script will read data from the database and construct the Applet PARAM tags - hence producing a Real-Time Dynamic Graph with data direct from a database within the web page.

Step 1 - Construct the Dynamic Script
The dynamic script can be constructed in any language of your choice. Most Web Servers these days come set up with a dynamic scripting language which is configured to access your database system. For convenience we recommend using the language already configured on your web server.

(if you haven't used or are unsure about what's already available on your web server then you should in the first instance speak to your Web Server Administrator or ISP Hosting company ).

The following are the most common Scripting languages and cover over 90% of web servers in use today,

  • PHP
  • ASP (and ASP.NET)
  • JSP
  • Java Servlet
The following text boxes contain some example script written in the above languages. These are provided for you to copy and base your own script on. In each case the script is written to connect to MySQL database and retrieve data from a table. The data from the database is then used to dynamically populate the data parameters for the graph.

Template PHP dynamic graph page:-


Template ASP dynamic graph page:-


Template JSP dynamic graph page:-


Template Java Servlet dynamic graph page:-


Adjust the values to create the line graph style you require.

For a full description of each property please see the following section in the Documentation,
"Line Graph Parameter Reference"

Step 2 - Upload the jar and script file to your web server.
The final step is to simply to upload the script to your web server and place the Linegraph.jar (contained in the ./AppletFiles/ files directory of the downloaded package)file in the same directory as your script.

The Graphs and Charts Package can be downloaded here

The jar file contains the compiled Java code (software) which produces the graph image at page view time.

Further Help and Support
If it any stage you require help, advice or simply have a general enquiry then please feel free to contact us.

Contact Support here
Related Information
Documentation
Demos and Examples
Custom Solutions Center
If would like us to perform the set-up process, create custom built data scripts or help with any other part of your web application then we are pleased to offer you the following services:-
JavaScript CSS Image Gallery