Applet Example 2

Here the graph applet is configured to read the configuration data from the HTML <PARAM> tags and to acquire the graph data from a text file.

 

The graph data is acquired from the text file bardata.txt ( click here to view ) and the graph properties are set by the following HTML code,

<applet code="LineGraphApplet.class" archive="LineGraph.jar" width="500" height="420">

<!-- Start Up Parameters -->
<PARAM name="LOADINGMESSAGE" value="Line Graph Loading - 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="chartdata" value="linedata.txt">

<!-- Chart Switches -->
<PARAM name="3D" value="false"> <!-- 3D mode On/Off -->
<PARAM name="grid" value="true"> <!-- Grid On/Off -->
<PARAM name="axis" value="true"> <!-- Axis On/Off -->
<PARAM name="ylabels" value="true"> <!-- y Labels On/Off -->
<PARAM name="outline" value="true"> <!-- Outline On/Off -->
<PARAM name="legend" value="true"> <!-- Legend On/Off -->

<!-- Chart Characteristics -->
<PARAM name="nPoints" value="12"> <!-- Max Number of Points per series-->
<PARAM name="nRows" value="7"> <!-- Number of Rows for the grid -->
<PARAM name="vSpace" value="30"> <!-- Vertical spacing, number of Pixels -->
<PARAM name="nSeries" value="3"> <!-- Number of Series -->
<PARAM name="hSpace" value="30"> <!-- Horizontal spacing, Pixels-->
<PARAM name="gridxpos" value="75"> <!-- X position to start grid -->
<PARAM name="gridypos" value="350"> <!-- Y position to start grid -->
<PARAM name="gridstyle" value="3"> <!-- grid line style -->
<PARAM name="depth3D" value="15"> <!-- Depth of 3D effect, number of Pixels -->
<PARAM name="ndecplaces" value="0"> <!-- Number of Decimal places to display values -->
<PARAM name="labelOrientation" value="5"> <!-- x axis label orientation -->
<PARAM name="labelsY" value="360"> <!-- Y position of x axis labels-->
<PARAM name="chartScale" value="1000"> <!-- Chart Scale -->
<PARAM name="chartStartY" value="0"> <!-- Starting Y value -->

<!-- x axis Labels -->
<PARAM name="label1" value="Jan">
<PARAM name="label2" value="Feb|-10">
<PARAM name="label3" value="Mar">
<PARAM name="label4" value="Apr|-10">
<PARAM name="label5" value="May">
<PARAM name="label6" value="Jun|-10">
<PARAM name="label7" value="Jul">
<PARAM name="label8" value="Aug|-10">
<PARAM name="label9" value="Sep">
<PARAM name="label10" value="Oct|-10">
<PARAM name="label11" value="Nov">
<PARAM name="label12" value="Dec|-10">

<!-- Additional font information -->
<PARAM name="font14" value="Arial,N,10"> <!-- Y labels Font -->
<PARAM name="font15" value="Arial,N,10"> <!-- X labels Font -->

<!-- Additional color information -->
<PARAM name="color14" value="170,170,170"> <!-- gridcolor -->
<PARAM name="color15" value="0,0,255"> <!-- axiscolor -->
<PARAM name="color16" value="0,100,170"> <!-- floorcolor -->
<PARAM name="color17" value="0,0,0"> <!-- outline color -->
<PARAM name="color18" value="50,50,50"> <!-- label color -->
<PARAM name="color19" value="50,50,50"> <!-- Y color -->

<!-- Legend Information -->
<PARAM name="legendfont" value="Arial,N,10"> <!-- Legend Font -->
<PARAM name="legendposition" value="345,15"> <!-- Legend Position -->
<PARAM name="legendtitle" value="Products"> <!-- Legend Title -->
<PARAM name="LegendBackground"value="166,210,255">
<PARAM name="LegendBorder"value="0,50,175">
<PARAM name="LegendtextColor"value="50,50,50">

<!-- Titles - Main, x and y -->
<!-- <PARAM name="title" value="text,xpos,ypos,font-type,font-style,font-size,Rcolor,Gcolor,Bcolor"> -->
<PARAM name="title" value="Sales by Quarter|80,60|Arial,BI,18|100,100,200">
<PARAM name="xtitle" value="Year 2001|200,400|Arial,B,16|100,100,200">
<PARAM name="ytitle" value="Value $|10,300|Arial,B,16|100,100,200">

<!-- Free Form Text -->
<!-- <PARAM name="textn" value="text,xpos,ypos,font-type,font-style,font-size,Rcolor,Gcolor,Bcolor"> -->
<PARAM name="text1" value="Note :|80,85|Arial,N,10|100,100,200">
<PARAM name="text2" value="Product Z launched April|85,100|Arial,N,10|50,50,50">
<PARAM name="text3" value="Product Y discontinued in October|85,115|Arial,N,10|50,50,50">

<!-- Series Data -->
<!-- <PARAM name="seriesN" value="series color|point style|Point Size|fill|legend label"> -->
<PARAM name="series1" value="99,99,156|5|8|false|Product X">
<PARAM name="series2" value="185,53,8|3|8|true|Product Y">
<PARAM name="series3" value="239,154,65|4|8|false|Product Z">

<!-- Trend Lines -->
<!-- color|start point|end point|start value|end value|label|font -->
<PARAM name="trend1" value="0,0,0|7|12|2200|3300|Upper trend|Arial,B,12">
<PARAM name="trend2" value="0,0,0|8|12|900|1550|Lower trend|Arial,B,12">

<!-- Target Lines -->
<!-- color|style|start point|end point|value|label|font -->
<PARAM name="target1" value="0,125,0|4|1|12|5500|Target|Arial,N,10">
<PARAM name="target2" value="125,0,0|4|1|12|1500|Break Even|Arial,N,10">

</applet>

For a full explanation of and range of values for the above parameters please see the Documentation.

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