Reading data from an XML source

Series values and chart labels are usually passed to the applets using parameters. The use of parameters to receive data frequently changed might not be a viable solution, in that the html content has to be always reloaded to reflect changes.
To address this shortcoming, an XML parser was implemented in JetChart to read data coming from an XML source, as a file located under the applet codebase directory or a character input stream originated from the same server the applet is loaded from. The first time an applet is loaded, the XML data is read and parsed to feed chart, and if a refresh period is informed, only the XML data is periodically reloaded, not the entire html code.

The XML data source structure must adhere to some rules, which are described here.

The example below displays a bar chart that loads chart labels and series values from an XML file located at the applet codebase directory. A refresh period of 5 seconds is defined. If the XML file content is modified, the chart is automatically updated to reflect changes.



<applet code="GraphApplet.class" codebase="../../../demo/applets/classes" archive="GraphChart.jar" width=550 height=300>

<param name="xmldatasourceurl" value="graphchart.xml">
<param name="timerinterval" value="5">

<param name="borderon" value="no">
<param name="title" value="The JetChart Library,Reading data from an XML source">
<param name="tooltipson" value="yes">

<param name="serie1" value="bar,Green bar series,009900">
<param name="serie2" value="bar,Red bar series,ff0000">
</applet>