area graph

2D/3D Area Graph for PHP

[ Graph Home ] [ Set-Up ] [ Tutorials ] [ Documentation ] [ Buy Now ] [ Support ]

2D/3D Area Graph for PHP

Documentation - Adding data to a graph

Data may be added to the graph in one of three ways:-

Retrieving Data from files »

Retrieving Data from another server process »

Retrieving Data from a MySQL Database »

 

Retrieving Data from files

To set the graph to read the data from file simply add the "data" parameter to the URL string of the <IMG> tag. For example if the data file is "graphdata.txt" then your <IMG> tag would become:-

<img src="area-graph.php?data=graphdata.txt"
width=500 height=500>

 

Data Format

Within the file the data should follow this format:-

dataNseriesM: [value]

where N represents the position of the data item in the series and M represents the series number.

For example for 3 series of data each containing 6 points the contents of the data file would be:-

data1series1: 30
data2series1: 20
data3series1: -10
data4series1: 40
data5series1: 50
data6series1: 60

data4series2: 40
data5series2: 50
data6series2: 60

data1series3: 100
data2series3: 50
data3series3: -25
data4series3: 75
data5series3: 125
data6series3: 150

 

«back to top

 

Retrieving Data from another server process

To set the graph to read the data from another server side process (ie. PHP, ASP, JSP etc) simply add the "data" parameter to the URL string of the <IMG> tag.
For example if the data script is "graphdata.php" then your <IMG> tag would become:-

<img src="area-graph.php?data=graphdata.php"
width=500 height=500>

 

Data Format

The data script should be written such that it outputs the data in the following format:-

dataNseriesM: [value]

where N represents the position of the data item in the series and M represents the series number.

For example for 3 series of data each containing 6 points the output of the data script would be:-

data1series1: 30
data2series1: 20
data3series1: -10
data4series1: 40
data5series1: 50
data6series1: 60

data4series2: 40
data5series2: 50
data6series2: 60

data1series3: 100
data2series3: 50
data3series3: -25
data4series3: 75
data5series3: 125
data6series3: 150

«back to top

Retrieving Data from a MySQL Database

The graph can be set to connect to and retieve data directly from a MySQL database. In order to do this the graphing software requires some information about the database. This information should be placed in a file which can be read by the graphing software. The filename should then be specified in the URL string of the <IMG> tag with the parameter "dbinfo"

For example, if the file containing the db information is "dbinfo.txt" then the <IMG> would be:-

<img src="area-graph.php?dbinfo=dbinfo.txt"
width=500 height=500>

The dbinfo file will need to contain the following information:-

server:
username:
password:
database:

a SELECT statement for each series of data.

For example, if a MySQL db named "Sales" has a username of "salesaccess" and a password of "dbpass" with 3 tables "product1", "product2" and "product3" then the dbinfo contents would be:-

server: localhost
username: salesaccess
password: dbpass
database: Sales

SELECT priceUSD FROM product1
SELECT priceUSD FROM product2
SELECT priceUSD FROM product3

Please note: Do NOT add the semi-colon character to the end of the SELECT statements.

 

«back to top

« back to Getting Started
[ Graph Home ] [ Set-Up ] [ Tutorials ] [ Documentation ] [ Buy Now ] [ Support ]

How it Works »

How the graphing software works.

Quick Set-Up and Install »

step-by- step guide to add graphing for your site.

Tutorials »

Introducing many powerful features.

Licensing and Purchase Options »

Click the 'Buy & Download' button to review options.

buy and download area graph graph for php

Documentation »

Full documentation

Help and Support »

If at any stage you require help or advice then please feel free to ask.

Contact us here »