The Applet form of the Graph has several methods exposed
which enable the properties and data of the graph to
be updated dynamically from other page objects.
So that the Graph may be referenced from other page
objects it must first be named. This is done by adding
the 'name' parameter to the <applet> tag. i.e,
<applet
name="GRAPH"
code="PiechartApplet.class"
archive="Piechart.jar" width="500"
height="420" mayscript>
The methods are,
Set a Data Value
Reload Data
Set a Parameter
Size Reset
Set a Data Value
set_datavalue(int
pienum, int segment, String value, boolean re_paint)
This method enables any of the graph data values
to be changed.
pienum - this specifies the pie number
of the pie to be changed.
segment - this specifies which segment
within the pie is to be changed. eg. 3 would
represent the 3rd segment value of the pie.
value - the value to which this data
item should be set.
re-paint - specifies whether the graph
should be re-drawn once the data value is set.
Value can be either "true" or "false"
e.g. to add a button to your web page which will
update the second data value of series 1,
<input
type="button" value="Update Data
Item" onclick="document.applets['GRAPH'].set_datavalue(1,2,"52.4",
true);">
^back to top
|
Reload Data
reload_data(String
value, boolean re_paint)
This method enables all the graph data to be
reloaded from a file or server side process. This
method is particularly useful where you wish the
chart data to be refreshed either by a user action
or time interval.
value - the URL specifyig the location
of the data file or server side process supplying
the data
re-paint - specifies whether the graph
should be re-drawn once the data is loaded.
Values may be either "true" or "false".
^back to top
|
Set a Parameter (graph property)
set_parameter(String
parmname, String value, boolean re_paint)
This method enables any of the Graph Parameters
to be modified dynamically during runtime.
parmname - this is the property name
as defined in the Parameters
section.
value - the value which this property
should be set.
re-paint - specifies whether the graph
should be re-drawn once the parameter is set.
Value can be either "true" or "false"
e.g. to add a button to your web page which will
turn the 3D effect off,
<input
type="button" value="3D Off"
onclick="document.applets['GRAPH'].set_param('3D',
'false', true);">
^back to top
|
Size Reset
size_reset(int
width, int height, boolean re_paint)
This method enables the display area (size) of
the pie chart to changed.
width - specifies the new width in pixels
height - specifies the new height in
pixels
re-paint - specifies whether the graph
should be re-drawn once the size is changed.
Value can be either "true" or "false"
e.g. to add a button to your web page which will
change the size to 200x200 pixels,
<input
type="button" value="Set Size"
onclick="document.applets['GRAPH'].size_reset(200,
200, true);">
^back to top
|
For a demonstration of these methods see Applet
Example 8- click here
|