Applet Example 4
The applet
is setup here to read the configuration data from a text file
and the graph data from a server side process, in this case
a Java Servlet running on our web server.
The configuration
data is acquired from the text file barprops.txt
(click here to view)
and the graph data is acquired from the servlet SHbarDataServlet.java
(click here to view).
and here
is the HTML code,
<applet code="SHbarchartApplet.class"
archive="SHbarchart.jar" width="450"
height="440" mayscript>
<!-- Start Up Parameters -->
<PARAM name="LOADINGMESSAGE" value="Creating
Chart - 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="barprops.txt">
<PARAM name="chartdata" value="http://www.trafficfile.com/servlet/SHbarDataServlet">
</applet>
The SHbarDataServlet
( click
here to view code ) is a simple servlet designed to demonstrate
how a servlet can be used to return data to either the graphing
applet or servlet. As you will see the main routine ( doGet()
) uses the method GraphData() to construct the return data.
Although in this example the GraphData() routine simply builds
the return data from 'hard coded' values, in practice this
routine would be expanded to first gather data from any number
of datasources. eg. databases, files other server processes.
Note:
If you are using the evaluation version then in the applet
a pop-up window will appear upon the startup and an evaluation
message will be incorporated by the servlet. Both these features
have been removed from the licensed version. Licensing information
can be found at http://www.jpowered.com/graph_chart/index.htm
<< back to Examples Index
<< back to Getting
Started
|