Advanced
Stacked Vertical Bar Graph, version 3.2
by Sirius Computer Consultants Limited
Applet
- Servlet Combination
One
of the factors to consider when deciding between implementing
the applet or servlet form of the graph is that, browsers
in general do not print applets very well and the results
can vary between browser makes and versions. The servlet
however returns the graph image to the browser in GIF format
and as such will print consistently without any problems
across all browser makes and versions.
Another
factor to consider when deciding to implement the applet
or servlet is whether the interactive features of the applet
are required (mouseover pop-ups and mouseclick URL functionality).
In the servlet form, the graph is returned to the browser
as a GIF image and as such the interactive features of the
applet are not available.
This
example demonstrates how to implement the applet and servlet
together so that all the interactive features of the applet
are presented to the user and also giving the user the option
of printing the page containing the graph.
On this
first page we implement the applet ( which acquires both
the configuration and graph data from data files). Clicking
on the note at the foot of the graph will bring up an almost
identical page which contains the servlet implementation
which is universally printable.
The
configuration data is acquired from the text file barprops.txt
(click here to view)
and the graph data is acquired from the text file bardata.txt
(click here to view).
and
here is the HTML code,
<img
src="http://localhost:8080/servlet/SVbarchartServlet?
config=http://www.jpowered.com/bar_graph/svbargraph/Examples/barprops.txt&
data=http://www.jpowered.com/bar_graph/svbargraph/Examples/bardata.txt"
width="450" height="420">