Step
3 - Set up the Line Graph data
As with the configuration data there are two options
for supplying the data values to the servlet,
a)
Data File.
The servlet will read all the data from a specified
file. To use this option incorporate the url
of the data file into the the IMG tag (see Step
4).
The
"../../line_graph/Documentation/linedata.txt" file contained in this
directory is an example file containing the
data ( click
here to view the example file ). As you
will see from the example file each piece of
data is specified on a name, value basis.
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 servlet the ability to retrieve data from
databases. This method involves specifying a
server side script in the <IMG> tag of
the html page (see Step 4) which in turn returns
the data to the graph servlet, 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 servlet to retrieve data from a
server side script simply add the URL of your
server side script into the <IMG> tag
of the HTML page (see Step 4). 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 LineDataServlet.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).
|