Both
the applet and servlet can be set to retrieve the graph
data from a data file. The data file is simply a list
of the data names with the value for each data element
of the graph.
The
first 20 character positions of a line in this file specify
the data element name whilst position 21 onwards represent
the value for that data element.
Comment
Lines: Any line in the file which is either blank
or begins with <!-- will be ignored. Therefore comment
lines may be added to file by beginning the line with
<!--.
We
recommend that, rather than building a data file from
scratch, that you take a copy of the example file piedata.txt
file and modify the values to suite your implementation.
In
both the applet and servlet, the data file is specified
via a URL parameter and therefore the file can be placed
in any directory (or server) accessible via a URL. However
we recommend,for ease of maintainability, keeping this
data file in the same directory as your web page which
incorporates the pie chart.
Data
Element Naming Convention.
The
graph is capable of displaying multiple series of data
(multiple pies) in the same chart and therefore it is
necessary to specify which series each piece of data belongs.
In addition it is also important to specify the order
in which data should be taken for each series. This is
done by the Name of each element.
The
data name format is,
dataNseriesM
where
N is an integer number representing this data position
within the series and M is an integer specifying the series.
Both
the data and series numbering should be continuous and
begin with 1.
For
example if we have 3 series of data each with four pieces
of data the data names would be,
data1series1
data2series1
data3series1
data4series1
data1series2
data2series2
data3series2
data4series2
data1series3
data2series3
data3series3
data4series3
Data
Values
The
data value for each piece of data can either be an integer
or real / floating point number. In addition if the data
file is being constructed for use by the applet, two further
elements may be added, which define a URL and a Target
frame for this data's pie segment. To add a URL and target
frame to a piece of data simply add the URL and target
frame name to the end of the line separating each with
comma "," character.
e.g..
data1series1 7000,http://www.jpowered.com,framename
In
the applet implementation the URL and Target elements
may also be used to execute a piece of JavaScript within
the HTML page. For further details on this please see
the section "Pie Chart &
JavaScript"
Please
Note: URL and Frame specification is not valid for
the servlet implementation.