Linegraph Data.htm:
<html>
<head>
<TITLE>2D/3D Line Graph Software for PHP by JPowered.com</TITLE>
<META NAME="description" content="JPowered is a leading provider of Java & Javascript Software. With our Java & Javascript software you will be quickly adding great looking components to your web pages and applications.">
<META NAME="keywords" content="bar, graph, graphs, chart, charts, line graph, line graphs, line chart, line charts, php, php graph, php chart, php script, line graph graph, line graph chart">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK REL=STYLESHEET TYPE="text/css" HREF="../../images/jpowered_style.css">
</head>
<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<BR>
<!-- One big table contain only one cell -->
<table width="730" border="0" cellspacing="0" cellpadding="1" bgcolor="#FFAA00" align="center">
<tr>
<td>
<table width="730" border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" align="center">
<tr>
<td> <!-- Heading section that includes Logo, Title and Links -->
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="heading_cell" rowspan="2" bgcolor="#FFCC00"><img src="../../images/jpowered.gif" width="270" height="60" align="left" alt="line graph"></td>
<td class="heading_cell" bgcolor="#FFCC00">
<h1 class="heading"> 2D/3D Line Graph for PHP</h1>
</td>
</tr>
<tr>
<td class="menu_cell" bgcolor="#F0F0B0" valign="top"> <img src="../../images/curve.gif" width="22" height="18" vspace="0" hspace="0" align="left" alt="line chart">
[<a href="http://www.jpowered.com"> Home </a>]
[<a href="http://www.jpowered.com/products.htm"> Products </a>]
[<a href="http://www.jpowered.com/downloads.htm"> Downloads </a>]
[<a href="http://www.jpowered.com/purchase.htm"> Purchase </a>]
[<a href="http://www.jpowered.com/free_java_applet/index.htm"> Free Applets </a>]
[<a href="http://www.jpowered.com/support.htm"> Support </a>]<br>
[<a href="http://www.jpowered.com/aboutus.htm"> About Us </a>]
[<a href="http://www.jpowered.com/java_sitemap.htm"> Site Map </a>]
[<a href="http://www.jpowered.com/java_resources.htm"> Java Resources </a>]
</td>
</tr>
</table>
<!-- Content section that includes Main left hand column 430 pixels wide with right hand column taking remaining 200 pixels. -->
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td width="560" valign="top"> <!-- begin content -->
<table width="100%" border="0" cellpadding="5">
<tr valign="top" align="left" bgcolor="#99CCFF">
<td colspan="4"> <font color="#009900"><b><font face="Arial, Helvetica, sans-serif" color="#FF9933"><a name="top"></a></font></b></font>[
<a href="http://www.jpowered.com/php-scripts/adv-graph-chart/index.htm">
Graph Home</a> ] [ <a href="../../quick-set-up.htm">Set-Up</a>
] [ <a href="../../tutorials/index.htm">Tutorials</a> ] [
<a href="../../documentation/index.htm"> Documentation</a>
] [ <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm">
Buy Now</a> ] [ <a href="http://www.jpowered.com/support.htm">
Support</a> ] </td>
</tr>
<tr align="left" valign="top">
<td colspan="4">
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr>
<td colspan="2">
<table width="100%" border="0" cellspacing="0" cellpadding="4">
<tr>
<td width="87%">
<h2><font color="#009900"><b><font face="Arial, Helvetica, sans-serif" color="#FF9933">2D/3D
Line Graph for PHP </font></b></font></h2>
<p><font color="#009900"><b><font color="#666666">Documentation
- Adding data to a graph</font></b></font></p>
</td>
<td width="60" valign="middle" align="center"><img src="../../images/line-graph-icon.gif" width="50" height="50"></td>
</tr>
</table>
</td>
</tr>
<tr valign="top" align="center">
<td colspan="2">
<p align="left">Data may be added to the graph in one of four ways:-</p>
<blockquote>
<p align="left"><a href="#datafiles">Retrieving
Data from files »</a></p>
<p align="left"><a href="#serverprocess">Retrieving
Data from another server process »</a></p>
<p align="left"><a href="#database">Retrieving Data from a MySQL Database »</a></p>
<p align="left"><a href="#datascript">A PHP Data Script »</a></p>
</blockquote>
<p> </p>
<p><a name="datafiles"></a></p>
<table width="500" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCAA">
<td><b><font color="#555500">Retrieving
Data from files</font></b></td>
</tr>
<tr bgcolor="#EEEEDD">
<td>
<p>To set the graph to read the data
from file simply add the "<b>data</b>"
parameter to the URL string of the
<IMG> tag. For example if the
data file is "graphdata.txt"
then your <IMG> tag would become:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600"><font face="Courier New, Courier, mono"><img
src="line-graph.php?<font color="#CC0000">data=graphdata.txt</font>"
<br>
width=500 height=500></font></font></td>
</tr>
</table>
<p> </p>
<p><b>Data Format</b></p>
<p>Within the file the data should follow
this format:-</p>
<blockquote>
<p><b>data<font color="#0000CC">N</font>series<font color="#0000CC">M</font>:<font color="#CC0033">
[value]</font></b></p>
</blockquote>
<p>where <b><font color="#0000CC">N</font></b>
represents the position of the data
item in the series and <font color="#0000CC"><b>M</b></font>
represents the series number.</p>
<p>For example for 3 series of data each containing 6 points the contents of the data file would be:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600">data1series1:
30<br>
data2series1: 20<br>
data3series1: -10<br>
data4series1: 40<br>
data5series1: 50<br>
data6series1: 60<br>
<br>
data4series2: 40<br>
data5series2: 50<br>
data6series2: 60<br>
<br>
data1series3: 100<br>
data2series3: 50<br>
data3series3: -25<br>
data4series3: 75<br>
data5series3: 125<br>
data6series3: 150</font></td>
</tr>
</table>
<p> </p>
<p><a href="#top">«back to top</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p>
<p><a name="serverprocess"></a></p>
<table width="500" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCAA">
<td><font color="#333300"><b><font color="#555500">Retrieving
Data from another server process</font></b></font></td>
</tr>
<tr bgcolor="#EEEEDD">
<td>
<p>To set the graph to read the data
from another server side process (ie.
PHP, ASP, JSP etc) simply add the
"<b>data</b>" parameter
to the URL string of the <IMG>
tag. <br>
For example if the data script is
"graphdata.php" then your
<IMG> tag would become:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600"><font face="Courier New, Courier, mono"><img
src="line-graph.php?<font color="#CC0000">data=graphdata.php</font>"
<br>
width=500 height=500></font></font></td>
</tr>
</table>
<p> </p>
<p><b>Data Format</b></p>
<p>The data script should be written
such that it outputs the data in the
following format:-</p>
<blockquote>
<p><b>data<font color="#0000CC">N</font>series<font color="#0000CC">M</font>:<font color="#CC0033">
[value]</font></b></p>
</blockquote>
<p>where <b><font color="#0000CC">N</font></b>
represents the position of the data
item in the series and <font color="#0000CC"><b>M</b></font>
represents the series number.</p>
<p>For example for 3 series of data each containing 6 points the output of the data script would be:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600">data1series1:
30<br>
data2series1: 20<br>
data3series1: -10<br>
data4series1: 40<br>
data5series1: 50<br>
data6series1: 60<br>
<br>
data4series2: 40<br>
data5series2: 50<br>
data6series2: 60<br>
<br>
data1series3: 100<br>
data2series3: 50<br>
data3series3: -25<br>
data4series3: 75<br>
data5series3: 125<br>
data6series3: 150</font></td>
</tr>
</table>
<p><a href="#top">«back to top</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><a name="database"></a></p>
<table width="500" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCAA">
<td><font color="#333300"><b><font color="#555500">Retrieving
Data from a MySQL Database</font></b></font></td>
</tr>
<tr bgcolor="#EEEEDD">
<td>
<p>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 "<b>dbinfo</b>"</p>
<p>For example, if the file containing
the db information is "dbinfo.txt"
then the <IMG> would be:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600"><font face="Courier New, Courier, mono"><img
src="line-graph.php?<font color="#CC0000">dbinfo=dbinfo.txt</font>"
<br>
width=500 height=500></font></font></td>
</tr>
</table>
<p>The dbinfo file will need to contain
the following information:-</p>
<blockquote>
<p><b><font color="#006666">server:
<br>
username: <br>
password: <br>
database: </font></b></p>
<p><font color="#006666"><b>a SELECT
statement for each series of data.</b></font></p>
</blockquote>
<p>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:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600">server:
localhost <br>
username: salesaccess<br>
password: dbpass<br>
database: Sales<br>
<br>
SELECT priceUSD FROM product1
<br>
SELECT priceUSD FROM product2
<br>
SELECT priceUSD FROM product3
</font> </td>
</tr>
</table>
<p><font color="#CC0000">Please note:
</font>Do NOT add the semi-colon character
to the end of the SELECT statements.
</p>
<p> </p>
<p><a href="#top">«back to top</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p><a name="datascript"></a></p>
<table width="500" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="5">
<tr bgcolor="#CCCCAA">
<td><font color="#333300"><b><font color="#555500">A PHP Data Script</font></b></font></td>
</tr>
<tr bgcolor="#EEEEDD">
<td>
<p>This feature allows you to create your own custom PHP Data Script function. The function will be included at
run time and used by the graph to acquire the data.</p>
<p>This method provides enormous flexibility for the data acquisition process. In addition any SESSION data (such
as a user ID) that exists will also be available to this data script. </p>
<p>A custom data script is specified via the parameter "<b>datascript</b>". For example if your data
script is in a file datascript.php which resides in the same directory as the graph function then your <IMG>
tag would be:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600"><font face="Courier New, Courier, mono"><img src="</font><font color="#006600"><font face="Courier New, Courier, mono">line-graph.php</font></font><font face="Courier New, Courier, mono">?<font color="#CC0000">datascript=datascript.php</font>"
<br>
width=500 height=500></font></font></td>
</tr>
</table>
<p>The data script must be valid PHP code and should contain at least the following function:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td>
<p><font color="#0000FF" face="Courier New, Courier, mono">function</font><font color="#000000" face="Courier New, Courier, mono">
datascript</font><font color="#006600" face="Courier New, Courier, mono"><font color="#FF0000">() {</font></font></p>
<p> </p>
<blockquote>
<p><font color="#0000FF" face="Courier New, Courier, mono">return</font><font face="Courier New, Courier, mono">
$lines;</font></p>
</blockquote>
<p><font color="#FF0000" face="Courier New, Courier, mono">}</font></p>
</td>
</tr>
</table>
<p>where $lines is a string array containing the data parameters and values.</p>
<p>The contents of the string array should be the format:- </p>
<blockquote>
<p><b>data<font color="#0000CC">N</font>series<font color="#0000CC">M</font>:<font color="#CC0033"> [value]</font></b></p>
</blockquote>
<p>where <b><font color="#0000CC">N</font></b> represents the position of the data item in the series and <font color="#0000CC"><b>M</b></font>
represents the series number.</p>
<p>For example, for 3 series of data each containing 6 points the string array contain:-</p>
<table width="400" border="0" cellspacing="0" cellpadding="6" bgcolor="#FFFFFF" align="center">
<tr>
<td><font color="#006600">data1series1: 30<br>
data2series1: 20<br>
data3series1: -10<br>
data4series1: 40<br>
data5series1: 50<br>
data6series1: 60<br>
<br>
data4series2: 40<br>
data5series2: 50<br>
data6series2: 60<br>
<br>
data1series3: 100<br>
data2series3: 50<br>
data3series3: -25<br>
data4series3: 75<br>
data5series3: 125<br>
data6series3: 150</font></td>
</tr>
</table>
<p> </p>
<p><font color="#FF0000">Note: <font color="#000000">The data script should under no circumstances write out any
information via the <font color="#0000FF">print</font> or <font color="#0000FF">echo</font> functions. This
would cause the production of the graph image to fail.</font></font></p>
<p> </p>
<p>For an example datascript.php and further guidance on how to use this method please see the<a href="../tutorials/index.htm">
Tutorial section <b></b></a><b><a href="../tutorials/index.htm"> »</a></b></p>
<p> </p>
<p> </p>
<p><a href="#top">«back to top</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
<p> </p></td>
</tr>
<tr valign="top" align="center">
<td colspan="2">
<table width="95%" border="0" cellspacing="0" cellpadding="3" align="center" bgcolor="#EEEECC">
<tr>
<td><a href="../../GettingStarted.htm">«
back to Getting Started</a></td>
<td>
<div align="right"><b><a href="../../quick-set-up.htm">
</a><a href="index.htm">Documentation
Index »</a></b></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr valign="top" align="left" bgcolor="#99CCFF">
<td colspan="4"> [ <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/index.htm">
Graph Home</a> ] [ <a href="../../quick-set-up.htm">Set-Up</a>
] [ <a href="../../tutorials/index.htm">Tutorials</a> ] [
<a href="../../documentation/index.htm"> Documentation</a>
] [ <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm">
Buy Now</a> ] [ <a href="http://www.jpowered.com/support.htm">
Support</a> ] </td>
</tr>
</table>
<blockquote>
<p> <!-- end content --> </p>
</blockquote>
</td>
<td valign="top" align="right">
<table width="182" border="0" cellspacing="0" cellpadding="3">
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA">
<td><b><a href="../../how-it-works.htm">How it Works
»</a></b></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>How the graphing software works. </p>
<p align="right"><a href="../../how-it-works.htm"><img src="../../images/arrow-green.gif" width="24" height="21" border="0"></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA" valign="middle">
<td><b><a href="../../quick-set-up.htm">Quick Set-Up
and Install » </a></b></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>step-by- step guide to add graphing for
your site. </p>
<p align="right"><a href="../../quick-set-up.htm"><img src="../../images/arrow-green.gif" width="24" height="21" border="0"></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA">
<td><b><a href="../../tutorials/index.htm">Tutorials
»</a></b></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>Introducing many powerful features.</p>
<p align="right"><a href="../../tutorials/index.htm"><img src="../../images/arrow-green.gif" width="24" height="21" border="0"></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA">
<td><b><a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm">Licensing
and Purchase Options »</a></b></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>Click the 'Buy & Download' button to
review options.</p>
<p align="right"> <a href="http://www.jpowered.com/php-scripts/adv-graph-chart/buy-now.htm"><img src="../../images/buy-download.gif" width="141" height="30" border="0" alt="buy and download line graph graph for php"></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA">
<td><b><a href="../../documentation/index.htm">Documentation
»</a></b></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>Full documentation </p>
<p align="right"><a href="../../documentation/index.htm"><img src="../../images/arrow-green.gif" width="24" height="21" border="0"></a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table width="175" border="0" cellspacing="0" cellpadding="1" bgcolor="#CC6600" height="100">
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="4" bgcolor="#FFFFFF" height="100%">
<tr bgcolor="#CCCCAA">
<td><a href="http://www.jpowered.com/support.htm">Help
and Support »</a></td>
</tr>
<tr valign="top" bgcolor="#EEEEDD">
<td>
<p>If at any stage you require help or advice
then please feel free to ask.</p>
<p align="right"><a href="http://www.jpowered.com/support.htm">Contact
us here »</a></p>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
<!-- Footer section that includes Links, Horizontal Rule and Copyright image -->
<table width="100%" border="0" cellspacing="0" cellpadding="2">
<tr>
<td class="menu_cell" bgcolor="#FFCC00">
<p class="bottom_menu">
[<a href="http://www.jpowered.com"> Home </a>]
[<a href="http://www.jpowered.com/products.htm"> Products </a>]
[<a href="http://www.jpowered.com/downloads.htm"> Downloads </a>]
[<a href="http://www.jpowered.com/purchase.htm"> Purchase </a>]
[<a href="http://www.jpowered.com/free_java_applet/index.htm"> Free Applets </a>]
[<a href="http://www.jpowered.com/support.htm"> Support </a>]<br>
[<a href="http://www.jpowered.com/aboutus.htm"> About Us </a>]
[<a href="http://www.jpowered.com/java_sitemap.htm"> Site Map </a>]
[<a href="http://www.jpowered.com/java_resources.htm"> Java Resources </a>]
<p>
</td>
</tr>
<tr bgcolor="#FFCC00">
<td class="heading_cell">
<div align="center"><img src="../../images/copyright.gif" width="450" height="25"></div>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>
Other Graphs And Charts Scripts: