Before following this tutorial it is essential
that the graph software has been installed.
If you have not yet done so then you should
complete the install procedure now,
Quick Set-Up
and Install »
This third tutorial demonstrates how to set
the graph to dynamically pull the data from
another PHP script. This method is not restricted
to just PHP scripts, but can be used for any
server side scripting program (eg. JSP, ASP,
Java Sevlet Perl etc).
Step
1 - Add the <IMG> tag
to your web page |
Add this HTML code to your
page
(replacing yourdomain.com
with the actual domain of
your web site and [URL
FilePath] with
the url of the web directory
where your page resides),
<img src="http://www.yourdomain.com/jpowered/piechart/pie-chart.php?
datascript=datascript.php&
config=[URL FilePath]/config.txt"
width=500
height=500>
|
Save the web page and load
it up to your web server.
|
|
Step 2 - Create the datascript.php file |
From the /tutorials/ directory (of
this package) copy the file datascript.php
to your web server.
This file should be placed in the same directory as the pie-chart.php file.
|
Notes:
The datascript.php script is a very simple little script which outputs the data
for the graph. In a real implementation this script would be expanded to first acquire the data from
another source ( series of files or database tables) and then output the calculated data.
|
Step 3- Create the config files |
From the /tutorials/ directory (of
this package) copy the config.txt to your web server.
This file should be placed in the same directory as your web page.
|
Notes:
For the function and options of each parameter see the following page:-
Graph Parameters »
|
|
Final
Step - View the page in a browser |
Open your web browser and
view the page.
You should see two Pie Charts with 4 and 6 segments respectively.
|
Follow-Up Suggestion:
Extend the datascript.php script to connect to one of your own databases and
construct data based upon the results of a query.
Now you have real-time graphing !
In addition any SESSION data that exists is also available to the data script
function. Therefore it would be possible to construct data based upon the current SESSION (eg. a user
ID).
|
When
to use this type of implementation. |
If your data is a result of a calculation method (eg. averaging a broad range of data etc) or is from
a database or you wish to dynamically acquire the data based upon a parameter of the current SESSION
then this method is an ideal solution.
|
|
Any
Problems ? |
In the vast majority of cases
(over 95%) the above is all
that is required. However
if you experience any problems
please feel free to tell us
and we will be happy to assist.
Contact
us here »
Please remember to include
the URL of your web page.
|
|
|