Step
3 - Set up the Pie Chart data
As with the configuration data there are three
options for supplying the bar data to the applet,
a)
Data File.
The applet will read all the data from a specified
file. To use this option add the following PARAM
tag to your html code between the <applet>
and </applet> tags,
<PARAM
name="chartdata" value="piedata.txt">
where
"piedata.txt" is the name of the file
containing the data ( click
here for an example file ). As you will
see from the example file each piece of data
is specified on a name, value basis. The first
element of each line represents the data name
(specifying the series and data order) and then
the value.
Simply create a similar file, adding your data
in the values. For a full explanation of this
file please see the "Retrieving Data from
Files" under the "Data and Configuration"
section ( or click here).
b)
Server Side process
This option is the most powerful and gives
the applet the ability to retrieve data from
databases without compromising database security.
This method involves specifying a server side
script in the html page which in turn returns
the data to the graph applet, giving enormous
flexibility for data acquisition.
The
server side script can be constructed in the
language of your choice and as such can be written
to acquire data from the widest variety of sources,
multiple databases etc.
To
instruct the applet to retrieve data from a
server side script simply insert the following
<PARAM> tag between the <APPLET>
and </APPLET> tags in your html page.
<PARAM
name="chartdata" value="[URL
of Server Process]"
inserting
the URL of your server side application in the
value element of this tag. The
server side script should be designed to output
the data in the same format as the file in option
a) above
For
an example script see PieDataServlet.java
in the ServerTemplateScripts directory.
For
a full description of constructing a server
side script which retrieves data from a database
see the section "Connecting the Graph to
a database" under the "Data and Configuration"
section ( or click here).
c)
HTML PARAM tags.
Using this option the applet will read all
the graph data from the standard applet <PARAM>
tags. Simply add the <PARAM> tags, contained
in the dataparamtags.txt file (click
here), to your html between the <APPLET>
and </APPLET> tag, adjusting the values
to specify the data for the bar graph.
This
option is the simplest method of supplying data
to the graph applet and is probably most useful
where the graph data is either static or the
html page is constructed dynamically, (eg.
Via ASP or JSP.)
^^
back to top
|