Location: PHPKode > scripts > Advanced Graphing Class > advanced-graphing-class/readme.html
<html><head>
<title>Advanced Graphing Class Readme</title>
<style>
body {
	font-family:"courier new";
	text-align:center;
	font-size:11pt;
}
h1,h2,h3,h4,h5 {
	text-align:center;
}
table,td,tr,th {
	text-align:center;
	border-collapse:collapse;
	font-family:"courier new";
	border:1px solid #DDDDDD;
	text-size:10pt;	
}
.no {
	border:0px;
	text-size:8pt;
}
</style>

</head><body onLoad="initButton()">
<div style="width:100%;background-color:#DD2222;color:#FFFFFF;font-family:arial">The most updated version of this document is available <a href="http://www.zackbloom.org/graph/examples.html" style="color:#CCCCCC">here</a>. You should always use that version if possible.</div><h1>Advanced Graphing Class V1.7.1</h1>
<img src="images/graphreadme.png">
<br><br>
This is a graphing class for PHP 5 that supports auto scaling, XML and CSV import, multiple datasets user defined size and color, and many options for end and point styles.  Read this for information on how to use it.
<br><br>
Please report <b>any</b> bugs and send <b>any</b> suggestions to <a href="mailto:hide@address.com">hide@address.com</a> or use the form below. I really love to hear both.
<br><br>Send me comments or suggestions:<form action="http://www.zackbloom.org/mailer.php" method="post">Email (optional) <input type="text" name="from"><br><textarea rows=6 cols=30 name="message"></textarea><br><input type="submit" value="Send"></form>

<br>
<a href="http://www.zackbloom.org/graph/examples.html">Examples</a>
<br><br><a href="http://zackbloom.org/graph/graph.oo.src.php">The Code</a>
<br><br><a href="http://zackbloom.org/graph/graph.oo.dl.php">Download</a>
<br>
<br>
<a href="http://code.google.com/p/advgraph/">Google Code</a>
<a href="http://www.phpclasses.org/advgraph/">PHPClasses.org</a>
<a href="http://freshmeat.net/projects/advgraph/">Freshmeat</a>
<br>
<h3>Table of contents</h3><br><center>
<ol>
<li value="1"><a href="#1">Hello World" Graph</a>
<li value="2"><a href="#2">Block point addition</a>
<li value="3"><a href="#3">Properities</a>
<li value="4"><a href="#4">Style options</a>
<li value="5"><a href="#5">CSV, XML and MySQL data importing</a>
<li value="6"><a href="#6">Inline format (easy way to make quick graphs)</a>
<li value="7"><a href="#7">Bar Charts</a>
<li value="8"><a href="#8">Pie Charts</a>
<li value="9"><a href="#9">Function Graphing</a>
<li value="10"><a href="#10">Output options</a>
<li value="11"><a href="#11">Method and property refrence</a>
<li value="12"><a href="#12">Development info and license</a></center>
</ol><br><br>
<h4>Files</h4>
<table>
<tr><th>Name<th>Description
<tr><td>graph.oo.php<td>The graphing class file.
<tr><td>test.php<td>Testing file. Open this on your browser to check your servers compatibility and test the class.
<tr><td>arial.ttf<td>Default font file.
<tr><td>wz_jsgraphics.js<td>Optional file required to output graphs as HTML.
<tr><td>examples-static.html<td>Static version of the example page. You should use the version on zackbloom.org if possible.
<tr><td>readme-static.html<td>Static version of the readme page. You should use the version on zackbloom.org if possible.
<tr><td>images\<td>Contains the images used by the example and test pages.
</table>
<br>
<h3><a name="1">1. "Hello World" Graph:</h3>
<br>
Their are 5 steps that must be followed to insert any type of graph using any data method, the steps should be followed in order.  This is the most rudimentary example and will probably not be enough for a full application.
<ol>
<li>Include my class, <code><span style="color: #000000">
<span style="color: #0000BB"></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">"graph.oo.php"</span><span style="color: #007700">;</span><span style="color: #0000BB"></span>
</span>
</code>.
<li>Create the graph object, <code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code>.
<li>Add data, for this example we will use the block addition method, <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code>. Make up some numbers and add 5 points.
<li>Create the graph, <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code>.
<li>Display the graph, <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code>.
</ol>
<br>So the full code is:<br><div>
<code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php
<br /></span><span style="color: #007700">include&nbsp;</span><span style="color: #DD0000">"graph.oo.php"</span><span style="color: #007700">;
<br /></span><span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">4</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"test.png"</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code><br>
&lt;img src="test.png"&gt;
<br>
 

	 
<img src="images/test.png">
</div>
<br><br><h3><a name="2">2. Block point addition:</h3>
<br>Block point addition is adding points through the same method you used in the last step.  In this you will create a more advanced graph in which you can specify the size and some basic options about the graph.
<b>From now on I will assume you have included my class, created the graph object and named it "$graph"</b>, you could actually name it anything, but use graph for now.
<br><br>
In the last step you ran the constructor with no arguments, which tells it you want to create a graph that is 400px by 200px with 10 grid lines on the X axis and 6 on the Y.
 Most applications require more control then that, you change those options use the constructor, which is the method that is called when you create, or construct, the graph object.
 The syntax of the constructor is:
 <br><br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">([[[[</span><span style="color: #0000BB">Width</span><span style="color: #007700">],</span><span style="color: #0000BB">Height</span><span style="color: #007700">],</span><span style="color: #0000BB">X&nbsp;Scale&nbsp;Increments</span><span style="color: #007700">],</span><span style="color: #0000BB">Y&nbsp;Scale&nbsp;Increments</span><span style="color: #007700">]);</span><span style="color: #0000BB"></span>
</span>
</code> <br><br>You don't have to include all the arguments, but all arguments to the left of an argument you want to include must have a value, so to include the X Scale you must also include the width and height.
 <br><br>
In this example you add data using the addPoint method, the syntax of the addPoint method is:<br><br>
<code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">dependent</span><span style="color: #007700">[[,</span><span style="color: #0000BB">independent</span><span style="color: #007700">],</span><span style="color: #0000BB">dataset</span><span style="color: #007700">]);</span><span style="color: #0000BB"></span>
</span>
</code><br>
<p>
The addPoint method returns an ID number that can be used to delete points.  If you will need to delete points you should store this value, otherwise its safe to ignore it.
</p>
<p>
<h4>Datasets</h4>
<br>
This class allows for an unlimited number of datasets. Each set has its own properties and is shown with a separate line on the graph.
 Using properties you can give each dataset its own color, line style, point style or any other property that can be set for the graph as a whole.
 <b>Datasets start at 0</b>, so the first set that is created when you run addPoint with only 1 argument is the zeroth.
 More information about how properties effect different datasets can be found in the property section.  You should always go in numerical order when using datasets.
 So you would add a point to the 2nd dataset like this: <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code>.
 If you want to use the dataset property but do not want to specify what the independent variable should be use -5 for the independent.
 delPoint will search in all datasets for the ID.  If the sort property is true the data will be sorted lowest to highest, while perserving the i-d relanshionship.  It is set to true by default.
</p>
<p>
If you don't include the independent var like <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">5</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> it will just assume
 the next number for the independent, so if you ran the last example it assumed 0,1,2,3... for the independent var.
In most cases you will have a dataset with predefined independents that you use the full syntax for, like <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">4</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> you can use decimal or integer values for both of the properties.
</p>
<p>
To define many points at once you can use the addBulkPoints method, it accepts a list of points like (4,2,4,5,6), an array of points, an array of points and datasets like array(array(i,d,l),array(i,d,l)...), a string of i:d pairs like ("3:3,3:2,..."), a string of l|i:d pairs (l being the dataset) like ("0|1:2,0|2:3,1|2:2") or a string of l|i pairs like ("0|1,0|3,1|3") and returns an array of the id's of the points it made.
</p>
<p>
After defining the points you have to run the graph method to actually create the graph.
 This is the step that takes processor time so should be done as few times as possible.
 Depending on the number of points and the processor speed available this usually takes from 20-50ms which is a very short amount of time.
 To determine the actual speed set the benchmark property to true, you'll learn about properties later in this readme.
 Run the graph method to graph it:
</p>
<code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code><br>
<p>
Finally, you must decide how to display the graph.
 In the last example you ran the showGraph method with no arguments, which inserted the image directly into the page along with the header to tell the page to process it as an image (the header can be disabled using the "noheader" property).
 That is fine for when you only want the image alone but if you want to insert it in a page you must tell the function the filename you want to store the image as.
 The showGraph function has 4 modes,<br>
  <ul><li>Without any arguments it will output the image directly to the page
  <li>With false as its only argument it will store the image as "graphImage.png", you can specify a prefix such as a directory using the "imagepre" property.
  <li>With "random" as its only argument it will store the image as "graphImage<i>&lt;Random Number&gt;</i>.png", and return the filename, "imagepre" also works here, this is useful for some AJAX applications where image caching is a problem.
  <li>With any other string as its argument it will store the image to that string
  </ul>
</p>
<p>Some AJAX applications cannot store variables between server requests.  Resetting all the data would take too long, insted you can store the entire graph in a file.
 Their are 3 specialized functions for this.  storeGraph stores the graph and image to a file, it is run by providing the location for the files.
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">storeGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"./cache/graph.data"</span><span style="color: #007700">,</span><span style="color: #DD0000">"./cache/image.data"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> if the keepcache property is set to false the cache will be automatically deleted when the object is destroyed.
 To retrive a stored graph use the retriveGraph and retriveImage functions.  Here is a full example:<br><br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();
<br />&nbsp;
<br />&nbsp;</span><span style="color: #FF8000">//Set&nbsp;some&nbsp;properties&nbsp;and&nbsp;datapoints
<br />&nbsp;
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">storeGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"datafile"</span><span style="color: #007700">,</span><span style="color: #DD0000">"imagefile"</span><span style="color: #007700">);
<br />&nbsp;
<br />&nbsp;</span><span style="color: #FF8000">//Later&nbsp;when&nbsp;you&nbsp;need&nbsp;to&nbsp;retrive&nbsp;it:
<br />&nbsp;
<br />&nbsp;</span><span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();
<br />&nbsp;</span><span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">retriveGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"datafile"</span><span style="color: #007700">);&nbsp;</span><span style="color: #FF8000">//You&nbsp;must&nbsp;set&nbsp;it&nbsp;equal&nbsp;to&nbsp;graph.
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">retriveImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"imagefile"</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">();&nbsp;</span><span style="color: #FF8000">//Just&nbsp;like&nbsp;normal
<br />&nbsp;</span><span style="color: #0000BB"></span>
</span>
</code><br><br><h4>Methods relating to datapoints and graphs:</h4>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>addPoint<td>Adds a datapoint<td>(independent)<br>(independent,dependent)<br>(array(independent,dependent))<td>ID that can be used with delPoint<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>delPoint<td>Removes a datapoint<td>(id)<br>(0,index)<td>true on success, false on failure<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">delPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>clearPoints<td>Removes all datapoints<td>()<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">clearPoints</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>addBulkPoints<td>Adds multiple datapoints<td>(i1,i2,...)<br>("i1,i2,...")<br>("i1:d1,i2:d2,...")<br>(array(i1,d1),array(i2,d2),...)<br>(array(i1,i2,...)<br>(array(array(i1,d1),array(i2,d2),...))<td>Array of IDs that can be used with delPoint<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addBulkPoints</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">,</span><span style="color: #0000BB">5</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>delBulkPoints<td>Removes multiple datapoints<td>(id1,id2,...)<br>("id1,id2,...")<br>(array(id1,id2,...))<br>Result of addBulkPoints<td>Array of booleans, true on success, false on failure<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">delBulkPoints</span><span style="color: #007700">(</span><span style="color: #0000BB">$ids</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>graph(constructor)<td>Constructor<td>()<br>(Width,Height)<br>(Width,Height,XScalePoints,YScalePoints)<td>graph object<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">,</span><span style="color: #0000BB">200</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>graph<td>Generates Graph<td>()<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>showGraph<td>Makes graph image<td>()<br>("random")<br>(false)<br>("imagesrc")<td>image location<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"./images/image.png"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <br><br>
<h3><a name="3">3. Properties:</h3>
<p>This class uses the function setProp and setBulkProp to set the value of properties and getProp to retrive those values.
 Properties are optional variables that allow you to set things like colors and styles.  All properties are optional and none are required to create a graph.
 One method to set a property is setProp:
 <br><br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #0000BB">name</span><span style="color: #007700">,</span><span style="color: #0000BB">value</span><span style="color: #007700">,[</span><span style="color: #0000BB">dataset</span><span style="color: #007700">]);</span><span style="color: #0000BB"></span>
</span>
</code> <br>
 <p>So you would use <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"pointwidth"</span><span style="color: #007700">,</span><span style="color: #0000BB">5</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> to set the width of points to 5.
 The setBulkProp method allows you to set many properties at once.  The setBulkProps method accepts a string as its only argument, the string should be formatted "name:value,name:value,name:value".
 To set the value of a color using setBulkProp separate each part with a hyphen like, <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setBulkProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"color:red-green-blue-alpha,2|pointstyle:3,backcolor:24-122-255,1|color:blue"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code>.  You can also use the same color names you can use in the setColor method.
 All the properties are listed in the function and property refrence.<br>
 To get the value of a property use the getProp method. getProp accepts the name of the property you want as a string and an optional default value.
 For example:<code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"endstyle"</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> would return the endstyle or 2 if the endstyle property could not be found.
 You can also set and retrive your own user defined properties. Case does not matter. If you wish to use the same properties across multiple graphs you can use the getPropArr and storePropArr which return and store the entire property array.
 </p>
 <h4>Properties and datasets</h4><br>
 <p>
 When you run the setProp or setBulkProp methods without setting the dataset your properties are saved as belonging to the -1 set.
 The -1 set refers to global properties.  When the class is looking for a property like backcolor it automatically uses the -1 set,
 when it looks for a property of a specific dataset it first looks in that set's properties and if it is not found their,
 looks in the global -1 set.  To set a property of a specific set use the dataset property of the setProp method
 (the global set is -1, the standard set you have been using for graphing in past steps is 0, each additional set is 1,2,...).
 In the setBulkProp method you denote the set with a vertical slash.  Heres an example of the setProp and setBulkProp methods:
 <code><span style="color: #000000">
<span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"pointheight"</span><span style="color: #007700">,</span><span style="color: #0000BB">10</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">);&nbsp;or&nbsp;</span><span style="color: #0000BB">setBulkProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"2|pointheight:10"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code>. Always go in numerical order when using datasets.
 <br><br>
 When using the getProp method, you can specify what dataset to retrive the data from.
 If your data has not been defined in that set the value from the global set will be returned.
 </p>
 <br><br><h4>Methods relating to properties:</h4><br>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>setProp<td>Defines a property<td>("name","value")<br>("name","value",dataset)<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"PointImgSrc"</span><span style="color: #007700">,</span><span style="color: #DD0000">"http://site.name/image.type"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>setBulkProp<td>Defines many properties<td>("name:value,name:value,...")<br>("set|name:value,...")<br>("name:value","name:value",...)<br>(array(name,value),array(name,value),...)<br>(array(name,value,set),...)<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setBulkProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"pOiNtimageSRC:site.scs,ENDstyle:3,color:4-34-122-32"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>getProp<td>Retrives property<td>("name")<br>("name",value to return if not defined)<br>("name",value to return if not defined,dataset)<td>value<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"endstyle"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>getPropArr<td>Retrives entire property array<td>()<td>Property array<td><code><span style="color: #000000">
<span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getPropArr</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>setPropArr<td>Replaces entire property array<td>(Property array)<td>null<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setPropArr</span><span style="color: #007700">(</span><span style="color: #0000BB">$arr</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <br><br>
 <h3><a name="4">4. Style Options:</h3>
 <br>
 <p>All of the styling is done using properties, so make sure you read section 3.
 You can specify the color of the background of the graph, the lines, the scale grid and numbers, the data points and the ending.
 You can change a color by changing the "backcolor","color","gridcolor","pointcolor" or "arrowcolor" property using the setProp method, providing an array for the value containing the red,green,blue and alpha values.
 The alpha value is from 0-100 and specifies how transparent the object is 0 being opaque, alpha is not required and will default to opaque.
 The other colors are 0-255. You can also use the setColor method, it allows you to pass an rgb value or the name of a color.
 Use -1 for the dataset to apply the color globaly (will be overridden by datasets if they have the same property) or for things like gridcolor that are global inherently.
 You could use "back","grid" or "" for the colors and "color" will be added.
 The setColor method is used like this: <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"backcolor"</span><span style="color: #007700">,-</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #DD0000">"red"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>&nbsp;or&nbsp;<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"gridcolor"</span><span style="color: #007700">,-</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">233</span><span style="color: #007700">,</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">122</span><span style="color: #007700">);&nbsp;or&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"color"</span><span style="color: #007700">,-</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">122</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">,</span><span style="color: #0000BB">13</span><span style="color: #007700">,</span><span style="color: #0000BB">32</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> The accepted color strings are "red","green","blue","teal","orange","pink","purple","yellow","white","lightgray","darkgray" and "black".
 <br><h4>Properties relating to color:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>color<td>Line Color<td>Blue
 <tr><td>backcolor<td>Background Color<td>White
 <tr><td>gridcolor<td>Scale Grid and Number Color<td>Light Gray
 <tr><td>pointcolor<td>Datapoint Color<td>Null
 <tr><td>arrowcolor<td>Line Ending Color<td>Null
 </table>
 <br><br><h4>Methods relating to color:</h4>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>setColor<td>Defines a color property<td>("object",dataset,"color")<br>("object",dataset,r,g,b)<br>("object",dataset,r,g,b,a)<br><td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"grid"</span><span style="color: #007700">,-</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #DD0000">"orange"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 </p><p>
 The pointstyle defines what shape appears at each graph point.  Set this property to 0 or don't change it to not show any shape.
 These are the valid point styles:<br><br>
 <table>
 <tr><th>Name<th>Description
 <tr style="font-weight:bold"><td>0<td>No Point
 <tr><td>1<td>Filled Rectangle or Square
 <tr><td>2<td>Open Rectangle or Square
 <tr><td>3<td>Filled Triangle
 <tr><td>4<td>Open Triangle
 <tr><td>7<td>Filled Ellipse or Circle
 <tr><td>8<td>Open Ellipse or Circle
 <tr><td>9<td>Image (pointimgsrc must be set)
 </table>
 <br><br>
 The pointwidth and pointheight properties define the size of the point, if only width is specified height defaults to width.
 By default the open shapes will fill the open area inside them, set the clearback property to true to stop this.
 The images in style 9 will be resized to the height and width.
 The pointimgsrc property defines the location of the jpeg,gif,png or bmp image to be imported.  If the pointimgscale property is true the point height will be set depending on the pointwidth to keep the pictures width:height ratio.
 The pointcolor property defines the color of the points (ignored with image style).
 <br><h4>Properties relating to points:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>pointstyle<td>The point style<td>0
 <tr><td>pointwidth<td>The width of points<td>5
 <tr><td>pointheight<td>The height of points<td>pointwidth
 <tr><td>pointcolor<td>The color of points<td>line color
 <tr><td>pointimgsrc<td>The location of the point image<td>null
 <tr><td>clearback<td>Don't erase the open area inside the point?<td>false
 </table>
 <br><br>
 </p><p>
 The endstyle defines if an arrow is used to end the graph.
 These are the valid arrow styles:<br><br>
 <table><tr><th>Name<th>Description
 <tr style="font-weight:bold"><td>0<td>No Arrow
 <tr><td>1<td>Open Arrow
 <tr><td>2<td>Filled Arrow
 </table>
 <br><br><h4>Properties relating to arrows:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>endstyle<td>The arrow style<td>0
 <tr><td>arrowwidth<td>The width of the arrow<td>25
 <tr><td>arrowangle<td>The angle of the arrow sides<td>14
 <tr><td>arrowcolor<td>The color of the arrow<td>line color
 </table>
 </p>
 <p>
 <h4>Grid and Scale</h4>
 <br><br>
 The autoscl property determins whether auto scaling will be used. To set your own scaling properties set autoscl to false and set the xsclmin, xsclmax, ysclmin and ysclmax properties to set the scaling.  The xsclpts and ysclpts properties define how many scale numbers and grid lines should be used.  The showgrid, showhorizscale and showvertscale define if the background grid, the horizontal numeric scale and the vertical scale should be shown respectively.  The sclline property defines how large each increment of the grid should be and the onfreq property defines how much of that should be the grid color and how much the back color (creating dotted lines).  onfreq is a decimal value from 0 to 1, 1 being a solid line.  The font, textsize and textangle properties define the font (arial is included), size and angle of the scale numbers.  The actwidth and actheight properties define the true height and width of the graph image including the scale.  If you wish to set the range of the graph, set the autosize propery to false and set the yMax,yMin,xMax and xMin variables.  They are variables (set $graph->yMax,...) not properties.
 </p>
 <p>
 Usually graphs will be shown in the order of their independent variable.  1,2,3... set the sort property to false to have the order be based on when you added the point.
 </p>
 <p>
 <br><h4>Properties relating to grid and scale:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>autoscl<th>If the program determins the scaling<td>true
 <tr><td>xsclmin<td>The lowest X scale point<td>auto
 <tr><td>xsclmax<td>The greatest X scale point<td>auto
 <tr><td>ysclmin<td>The lowest Y scale point<td>auto
 <tr><td>ysclmax<td>The greatest Y scale point<td>auto
 <tr><td>xsclpts<td>The number of scale points on the X axis<td>10
 <tr><td>ysclpts<td>The number of scale points on the Y axis<td>6
 <tr><td>showgrid<td>If the grid should appear<td>true
 <tr><td>showhorizscale<td>If the horizontal scale should appear<td>true
 <tr><td>showvertscale<td>If the vertical scale should appear<td>true
 <tr><td>sclline<td>The length of each segment of the grid<td>5
 <tr><td>onfreq<td>The amount of each segment of the grid that is on<td>.2
 <tr><td>font<td>The font used to show the numbers<td>arial.ttf
 <tr><td>textsize<td>The size in pt of the text<td>8
 <tr><td>textangle<td>The angle of the text<td>0
 <tr><td>actheight<td>The height of the graph image<td>height+30
 <tr><td>actwidth<td>The width of the graph image<td>width+30
 <tr><td>sort<td>Orders the points<td>true
 </table>
 </p>
 <script>
 <!--
 var d = new Date()
 var t = d.getTime()
 var n = 0;
 if(t<(1143231456834+7*24*3600)){
	document.write('<div style="background-color:#FFF8A0"><br><h1>NEW</h1><br>');
	n = 1;
}
window.onload = function(){if(n) document.getElementById("new").style.visibility = "visible";};
 -->
 </script>
 <h4>Scale</h4><br>
 <p>This class allows the horizontal markers to be numeric values defined by the independent variable of datapoints, dates defined by a start and end date and strings defined by the programmer.
 Numeric keys are automatically used, the number of keys shown is dependent on the xincpts property.  Date keys are used by changing the scale property to 'date' and setting the startdate and enddate properties.
 By default the enddate property will use the current date, but start date must be givin a value.  You can use a UNIX time stamp or the date in a string, using almost any format you wish.  
 By default years will only be shown if your date range spans multiple years, but you can turn the year display on and off using the showyear property.
 You can also optionally set the dateformat property:
 <br><table><tr><th>Value<th>Month Format<th>Year Format
 <tr><td>1<td>3 char<td>2 digit
 <tr><td>2<td>3 char<td>4 digit
 <tr><td>3<td>full<td>2 digit
 <tr><td>4<td>full<td>4 digit
 </table><br>
 If you set the scale property with an array of strings, the strings will be used as keys.
 </p><p>
 <br><h4>Properties relating to scale:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>scale<td>What type of keys to use<td>"numeric"
 <tr><td>dateformat<td>How to format the dates<td>1
 <tr><td>xincpts<td>The number of keys to show<td>10
 <tr><td>showyear<td>If years should be shown in dates<td>auto
 </table>
 </p>
 <h4>Keys</h4><br>
 <p>The class can display a key that lists names for datasets and their corresponding color and value.  The showkey property defines if the key is shown.  keysize and keyfont determin the size and font of the text inside the key.  keywidspc defines how much extra space is added between the graph and the left side of the key.
 <b>Possible values for the keyinfo property</b>
 <table>
 <tr><td>0<td>No Information Beyond Name
 <tr><td>1<td>Percentage
 <tr><td>2<td>Actual Value
 <tr><td>3<td>Both
 </table>
 <br>
 The key property defines what the key names are, for line graphs the keys are defined for each dataset:
 <br><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?
<br />&nbsp;$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">,</span><span style="color: #DD0000">"alpha"</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">,</span><span style="color: #DD0000">"beta"</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">,</span><span style="color: #DD0000">"delta"</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">?&gt;
<br /></span>&nbsp;OR
<br />&nbsp;<span style="color: #0000BB">&lt;?
<br />&nbsp;$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setBulkProps</span><span style="color: #007700">(</span><span style="color: #DD0000">"0|key:alpha,1|key:beta,2|key:delta"</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">?&gt;
<br /></span>&nbsp;</span>
</code> For pie and bar charts you set the key property to an array of names:
 <code><span style="color: #000000">

<br />&nbsp;<span style="color: #0000BB">&lt;?
<br />&nbsp;$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"key"</span><span style="color: #007700">,array(</span><span style="color: #DD0000">"alpha"</span><span style="color: #007700">,</span><span style="color: #DD0000">"beta"</span><span style="color: #007700">,</span><span style="color: #DD0000">"delta"</span><span style="color: #007700">));
<br />&nbsp;</span><span style="color: #0000BB">?&gt;
<br /></span>&nbsp;</span>
</code> <br><h4>Properties relating to keys:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>showkey<td>Show keys?<td>false
 <tr><td>keysize<td>Size of the keys<td>10
 <tr><td>keyfont<td>Font of the keys<td>"arial"
 <tr><td>keyinfo<td>What information is shown in the key<td>0
 <tr><td>keywidspc<td>Space between graph and left side of key<td>10
 </table>
 <h4>Titles and Labels</h4><br>
 <p>
 You can define a title, X axis label and Y axis label for the graph. 
 The title, xlabel and ylabel properties define the text to be shown in that area. 
 The titlesize and labelsize properties define the size of the text in those areas. 
 The labelcolor property defines the color of the labels and is set like other colors, using the setColor method.
 </p>
 <br><h4>Properties relating to titles and labels:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>title<td>Title String<td>none
 <tr><td>xlabel<td>X Axis Label String<td>none
 <tr><td>ylabel<td>Y Axis Label String<td>none
 <tr><td>titlesize<td>The size of the title<td>24
 <tr><td>labelsize<td>The size of the labels<td>14
 <tr><td>labelcolor<td>The colors of the labels<td>black
 </table>
 </p>
  <script>
 <!--
 if(t<(1143231456834+7*24*3600))
	document.write('</div>');
 -->
 </script>
 <p>
 <h4>Errors</h4>
 <br><br>
 When errors are triggered a description of the error in red appears on the graph, and if the error is serious a PHP error is triggered halting the execution of the program.  If you set the production property to true, the red errors will not appear and PHP errors tiggered by the graph will only say "An error has occured, please contact a webmaster" insted of the error description.
 </p>
 <p>
 <br><h4>Properties relating to errors</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>production<td>Hide errors?<td>false
 </table>
 <br><br><h3><a name="5">5. CSV, XML and MySQL data importing:</h3>
 <br>
 This class allows data importing using CSV (Comma separated Values) and XML (eXtensible Marking Languange).  Many programs allow for data export through one or both of these formats.<h4>CSV:</h4>
 CSV importing is done through the importCSV method:
 <br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importCSV</span><span style="color: #007700">(</span><span style="color: #DD0000">"file"</span><span style="color: #007700">[,</span><span style="color: #DD0000">"format"</span><span style="color: #007700">[,default&nbsp;</span><span style="color: #0000BB">dataset</span><span style="color: #007700">]]);</span><span style="color: #0000BB"></span>
</span>
</code> <br>
 <p>
 The file argument is simply the location of the CSV file to be imported.  The format argument defines how the file is formatted. If you used "l,d,i" for the format argument it would look on each line for 3 values and use them as the dataset, dependent and independent respectively. If you are not using any of the arguments (other then dependent) simply don't include it.  So just using "d" would import from a file with one number on each line, if you don't include i, it will increment by 1 each line, if you don't include l it will assume 0 unless you use the default dataset property.  So these are all valid: <br> <code><span style="color: #000000">
<span style="color: #0000BB">importCSV</span><span style="color: #007700">(</span><span style="color: #DD0000">"file.loc"</span><span style="color: #007700">,</span><span style="color: #DD0000">"i"</span><span style="color: #007700">)&nbsp;or&nbsp;</span><span style="color: #0000BB">importCSV</span><span style="color: #007700">(</span><span style="color: #DD0000">"file.loc"</span><span style="color: #007700">,</span><span style="color: #DD0000">"d,i"</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">)&nbsp;or&nbsp;</span><span style="color: #0000BB">importCSV</span><span style="color: #007700">(</span><span style="color: #DD0000">"file.loc"</span><span style="color: #007700">,</span><span style="color: #DD0000">"d,i,l"</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> <br> Commas must be used.<br>
 So in this file:<br><div style="border:1px solid #EEEEEE">
0,0<br>
1,1<br>
2,2<br>
3,3<br>
4,4<br>
5,5<br><br><br><img src="images/graphrea1.png">
</div>
 <br>You would use "d,i" for the format.
 </p><p>
 <h4>XML:</h4>
 XML importing is done through the importXML method:
 <br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importXML</span><span style="color: #007700">(</span><span style="color: #DD0000">"file"</span><span style="color: #007700">[,</span><span style="color: #DD0000">"independent"</span><span style="color: #007700">[,</span><span style="color: #DD0000">"dependent"</span><span style="color: #007700">[,</span><span style="color: #DD0000">"block"</span><span style="color: #007700">[,</span><span style="color: #0000BB">dataset</span><span style="color: #007700">]]]]);</span><span style="color: #0000BB"></span>
</span>
</code> </p><p>
 The file is the file to be imported.  Independent, dependent and block are the tags used for each in the file.  In this file:
 <br><div style="border:1px solid #EEEEEE">
 <code><span style="color: #000000">
<span style="color: #0000BB">
<br />&nbsp;</span><span style="color: #007700">&lt;</span><span style="color: #0000BB">data</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">1</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">4</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">3</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">6</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">2</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">3</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">4</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">5</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">3</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">i</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&lt;</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;</span><span style="color: #0000BB">5</span><span style="color: #007700">&lt;/</span><span style="color: #0000BB">d</span><span style="color: #007700">&gt;
<br />&nbsp;&nbsp;&nbsp;&nbsp;&lt;/</span><span style="color: #0000BB">point</span><span style="color: #007700">&gt;
<br />&lt;/</span><span style="color: #0000BB">data</span><span style="color: #007700">&gt;</span><span style="color: #0000BB"></span>
</span>
</code><br><br><img src="images/graphrea2.png">
 </div>
 You would use "i" for the independent, "d" for the dependent and "point" for the block. If no block is used you don't have to include it, use "".  The data can be among other tags (like the data tag above) but does not have to be, it could just be a string of "&lt;i&gt;4&lt;/i&gt;&lt;d&gt;2&lt;/d&gt;&lt;i&gt;6&lt;/i&gt;&lt;d&gt;3&lt;/d&gt;...".  Dataset defines which dataset to put the data in, it defaults to 0.  If you specify a string for dataset it will use that to find the dataset in the XML, so if "set" was your dataset and "point" was your point then you would use this: &lt;point set=1&gt; to specify a point in the second set (zero being the first).
 </p>
 <p>
 <h4>MySQL Importing:</h4>
 You can import data directly from a MySQL database.  To do this you use the importMySQL method:
 <code><span style="color: #000000">
<span style="color: #0000BB">&lt;?$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importMySQL</span><span style="color: #007700">(</span><span style="color: #DD0000">"table"</span><span style="color: #007700">,</span><span style="color: #DD0000">"field"</span><span style="color: #007700">,</span><span style="color: #0000BB">resource&nbsp;</span><span style="color: #007700">or&nbsp;</span><span style="color: #DD0000">"database"</span><span style="color: #007700">,[</span><span style="color: #DD0000">"user"</span><span style="color: #007700">,[</span><span style="color: #DD0000">"password"</span><span style="color: #007700">,[</span><span style="color: #DD0000">"server"</span><span style="color: #007700">,[</span><span style="color: #0000BB">frequency</span><span style="color: #007700">]]]])</span><span style="color: #0000BB">?&gt;</span>
</span>
</code>1 You can specify the database, user, password and server if you wish to have the class connect to your database.  If you need to connect to your database in a specialized way you may insted provide a MySQL resource for the database argument and omit the rest.  The frequency argument determins if data is retrived by frequency of results or each result is treated as a point.  You can use null for any arguments you do not want to include.  A MySQL resource is created like this:
 <code><span style="color: #000000">
<span style="color: #0000BB">&lt;?
<br />&nbsp;$m&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">mysql_connect</span><span style="color: #007700">(</span><span style="color: #DD0000">"server"</span><span style="color: #007700">,</span><span style="color: #DD0000">"username"</span><span style="color: #007700">,</span><span style="color: #DD0000">"password"</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">mysql_select_db</span><span style="color: #007700">(</span><span style="color: #DD0000">"database"</span><span style="color: #007700">,</span><span style="color: #0000BB">$m</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">importMySQL</span><span style="color: #007700">(</span><span style="color: #DD0000">"table"</span><span style="color: #007700">,</span><span style="color: #DD0000">"field"</span><span style="color: #007700">,</span><span style="color: #0000BB">$m</span><span style="color: #007700">);
<br />&nbsp;</span><span style="color: #0000BB">?&gt;</span>
</span>
</code>1 The class will graph the frequency of the values appearing in the database, see the example page.
 </p>
 <br>
 <h3><a name="6">6. Inline format:</h3>
 <br><p>
 The method used to make the CSV and XML graphs above is the inline format.  For example the XML graph's code is: <br>&lt;img src="&lt;?=createGraph("XML:testdata.xml",200,100)?&gt;"><br>
 To create inline graphs you must use the createGraph method. You run the createGraph method without creating a graph object (you do have to include the class) so you can't use $graph->createGraph, insted you preface it with graph::. <b>You do not need to create the graph object</b>:
 <br><br>
 <code><span style="color: #000000">
<span style="color: #0000BB">graph</span><span style="color: #007700">::</span><span style="color: #0000BB">createGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"data"</span><span style="color: #007700">,</span><span style="color: #0000BB">width</span><span style="color: #007700">,</span><span style="color: #0000BB">height</span><span style="color: #007700">,</span><span style="color: #DD0000">"properties"</span><span style="color: #007700">,</span><span style="color: #0000BB">random</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> <br><br>
 The data argument can be an XML file, a CSV file or raw datapoints.  Each piece of data in the data argument must be separated by a ":" (colon). The first piece must be the format being used, either "RAW" for raw data, "XML" for an XML file or "CSV" for an CSV file. The next piece must be the file if its an XML or CSV or the data if its RAW.
 <br><br>For XML or CSV:<br>
 You provide the same arguments you would provide to the XML or CSV functions, separated by a colon insted of a comma.  If you do not need to provide an argument just leave it out.
 <br><br>For RAW:<br>
 Enter data just as you would if you were using the addBulkPoints function, except you <b>use a ; (semicolon) where you would use a : (colon)</b>.
 The width and height arguments define the width and height of the graph. The properties argument uses the same format as the setBulkProps method (don't replace the colons with semicolons). You can also use the property array returned from the getPropArr method as the properties argument. If their are multiple graphs on one page the filename of the image will automatically increment. You can specify a folder for the graphs to be placed in with the tempfolder property.
 <br><br>
 <code><span style="color: #000000">
<span style="color: #0000BB">graph</span><span style="color: #007700">::</span><span style="color: #0000BB">createGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"RAW:1;3,2;4,1;6,1|3;2,1|8;7,1|2;3"</span><span style="color: #007700">,</span><span style="color: #0000BB">200</span><span style="color: #007700">,</span><span style="color: #0000BB">100</span><span style="color: #007700">,</span><span style="color: #DD0000">"0|color:blue,1|color:green,sort:true"</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code><br>
 <img src="images/graphrea3.png">
 <br><br>
 <h4>Random</h4><br>
 The random property, if true, will add a random string of numbers to each image to prevent caching (local storage by the browser). Unless you set the delold property to false, the location of each random image will be stored as a list in a file called "imagehistory<i>&lt;filename where image was made&gt;</i>.data". The filename is included in the path so you can have multiple pages in the same folder each with their own list. Once the amount specified in the cachehistory property (default 4), images have accumulated the oldest image will be destroyed as each new is added.<br><br>
 <h4>Methods relating to inline graphing</h4>
 <table><tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>createGraph<td>creates an inline graph<td>("format:data")<br>("format:data",width,height)<br>("format:data",width,height,"name:value,name:value",random)<td>filename of image<td><code><span style="color: #000000">
<span style="color: #0000BB">createGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"CSV:data.csv:e:d"</span><span style="color: #007700">,</span><span style="color: #0000BB">400</span><span style="color: #007700">,</span><span style="color: #0000BB">100</span><span style="color: #007700">,</span><span style="color: #DD0000">"backcolor:red"</span><span style="color: #007700">,</span><span style="color: #0000BB">true</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <br><h4>Properties relating to inline graphing</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>tempfolder<td>Folder prefix of images to be created (with trailing \)<td>""
 <tr><td>delold<td>If old images should be deleted using random<td>true
 <tr><td>cachehistory<td>How many images to keep at once when using delold<td>4
 </table></p><br>
 <h3><a name="7">7. Bar Charts:</h3>
 Most of this readme has focused on line graphs, but the class can also create bar charts.  To create a bar chart, set the type property to 'bar'.  The barwidth property is a float that sets the width of each bar, 1 is the full width allocated to them (no gap).  The bars may ethier be solid colors or gradients, if solid colors are used the color property determines the color, if the colorlist property is filled with an array of arrays of rgb values each will be used to color one bar in order, if colorlist is set to true the graph will use the default colorlist.  If the barstyle property is set to 1, gradients will be used, the gstartcolor and gendcolor determine the start and end colors of the bar and are set like all other colors.  The bordercolor property sets the color of a 1px border surrounding the bars and only applies if solid fills are used.  See the example page for demonstrations on how to use bar charts.  You can switch between bar and line charts without data loss.
 <br><h4>Properties relating to bar charts</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>type<td>What type of graph to create<td>"line"
 <tr><td>barwidth<td>Size of bar, as a decimal of max size<td>1
 <tr><td>barstyle<td>Style of bars, 0 is solid, 1 gradient<td>0
 <tr><td>colorlist<td>Array of arrays of rgb values, will be sequentially applied to bars, true will use default values<td>null
 <tr><td>gstartcolor<td>Beginning color of gradient<td>"white"
 <tr><td>gendcolor<td>End color of gradient<td>"black"
 </table></p><br>
 <br>
 <h3><a name="8">8. Pie Charts:</h3>
 This class can also create both 2D and 3D pie charts.  Set the type property to "pie".  The pieangle property defines what angle the pie is viewed at, 0 being a 2D graph and 90 the side of the pie.  String and date keys cannot be use with pies.  The useval property defines if the actual value or the percent of total is used as the key, false shows the percentage, true the actual value.  The colorlist property functions slightly differently in the pie then it does in the bar charts.  In pie charts a color list must be specified, but the default one used if none is specified has enough values for a 12 part graph.  The numspace property defines how much extra space is given for the key, higher numbers will move the keys further from the center of the graph.  
 <br><h4>Properties relating to pie charts</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>type<td>What type of graph to create<td>"line"
 <tr><td>pieangle<td>Angle of pie<td>35
 <tr><td>useval<td>Use actual value, not percentage for keys<td>false
 <tr><td>colorlist<td>Array of arrays of rgb values, will be sequentially applied to bars<td>12 colors
 <tr><td>numspace<td>Extra spacing between keys and center of graph, in pixels<td>5
 </table></p>
 <br>
 <h3><a name="9">9. Function Graphing:</h3>
 You can use the graphFunction method to graph mathmatical functions:<br>
 <code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graphFunction</span><span style="color: #007700">(function,</span><span style="color: #0000BB">minX</span><span style="color: #007700">,</span><span style="color: #0000BB">maxX</span><span style="color: #007700">[,</span><span style="color: #0000BB">dataset</span><span style="color: #007700">]);</span><span style="color: #0000BB"></span>
</span>
</code> <br>The function argument is the actual function you wish to graph, examples are 'x', 'pow(x,3)/2' or 'sqrt(tan(-x))'.  As you can see you use x for the independent var, the function not eval'd and produces no security risk what so ever, your mathmatical function will be manually evaluated not using phps functions, so their is no security risk what so ever. The minX and maxX arguments define where the X axis starts and stops, dataset determins where the points from the function will be placed.  Points will be added like any other point addition method and the function will return an array that could be passed to delBulkPoints to delete the graph.  You can use the xsclpts, ysclpts, xincpts and ysclpts properies to customize the alignment of your graph.  The funcinterval property defines the amount of X increment per data point, a value of .25 would create a datapoint at each .25 increment of X.  You can even define your own variables and functions, for example: $graph->evaluate('f(y,e)=y^2+e') or $graph->evaluate('s=34'). 
 <h4>Methods relating to function graphing</h4>
 <table><tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>graphFunction<td>Graphs a mathmatical function<td>('function',minX,maxX)<br>('function',minX,maxX,dataset)<td>Array for use with delBulkPoints<td><code><span style="color: #000000"><span style="color: #0000BB">graphFunction</span><span style="color: #007700">(</span><span style="color: #DD0000">"-(arctan(x)*2)/(12x)"</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">10</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
 <tr><td>evaluate<td>Evaluate a mathmatical expression<td>('expression')<td>Result<td><span style="color: #0000BB">evaluate</span><span style="color: #007700">(</span><span style="color: #DD0000">'f(d)=(d-2)^2'</span><span style="color: #007700">)</span>
 
</span>
</code> </table>
 <br><h4>Properties relating to function graphing</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>funcinterval<td>Graph increment per data point<td>.0625
 </table>
 <br>
 <h3><a name="10">10. Output Options:</h3>
 <br><br><p>
 As you learned in section 1, the showGraph method is used to display or return the graph image.  The method has 4 modes, determined by what argument is passed to it:
 <br><br><table>
 <tr><th>Argument<th>Description<th>Best Use
 <tr><td>true or nothing<td>Displays the graph onto the page, with the png header (if noheader is not false)<td>Sending the image to the browser directly, without an html page
 <tr><td>false<td>Stores the image in a file called graphImage.png, prefixed with the imagepre property, if set<td>Normal no-frills output
 <tr><td>"random"<td>Stores the image in a file called graphImage<i>&lt;random number&gt;</i>.png, prefixed with the imagepre property, if set<td>AJAX applications or where caching is a problem
 <tr><td>any other string<td>Stores the image to the string passed to it<td>Specialized output or multiple graphs on one page (without using the inline method where this is handled automatically)
 </table>
 </p><p>
 The method will return the filename or true if the graph was sent to the page directly.<br>
 <br><h4>Properties relating to output</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>noheader<td>Determins if the image/png header is sent when displaying the graph directly to the page<td>false
 <tr><td>imagepre<td>Prefix to use in default and generated image names (must include trailing /)<td>""
 </table></p>
 <p>
 <h5>Div Output</h5>
 The class can output a basic form of the graph as html layers.  To use this the graph object must be constructed in the head of the html document with "div" as the 5th argument in the graph constructor.  This will display the graph directly to the page, set the 6th argument of the graph constructor to the id of the HTML div layer you want the graph to appear in.  The document must be formatted like this:
 <div style="text-align:left"><code><span style="color: #000000">
&lt;html&gt;&lt;head&gt;
<br /><span style="color: #0000BB">&lt;?php
<br /></span><span style="color: #007700">include(</span><span style="color: #DD0000">"graph.oo.php"</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">(</span><span style="color: #0000BB">400</span><span style="color: #007700">,</span><span style="color: #0000BB">200</span><span style="color: #007700">,</span><span style="color: #0000BB">6</span><span style="color: #007700">,</span><span style="color: #0000BB">10</span><span style="color: #007700">,</span><span style="color: #DD0000">"div"</span><span style="color: #007700">,</span><span style="color: #DD0000">"graph"</span><span style="color: #007700">);
<br /></span><span style="color: #0000BB">?&gt;
<br /></span>&lt;/head&gt;&lt;body&gt;
<br />&lt;div&nbsp;id="graph"&gt;&lt;/div&gt;
<br /><span style="color: #0000BB">&lt;?php
<br /></span><span style="color: #FF8000">//Points
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();
<br /></span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">();
<br /></span><span style="color: #0000BB">?&gt;
<br /></span>&lt;/body&gt;&lt;/html&gt;
<br /></span>
</code></div>
 </p>
 <h3><a name="11">11. Method and property refrence:</h3>
 <br>
 <br><h4>Methods relating to datapoints and graphs:</h4>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>addPoint<td>Adds a datapoint<td>(independent)<br>(independent,dependent)<br>(array(independent,dependent))<td>ID that can be used with delPoint<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">2</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>delPoint<td>Removes a datapoint<td>(id)<br>(0,index)<td>true on success, false on failure<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">delPoint</span><span style="color: #007700">(</span><span style="color: #0000BB">$id</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>clearPoints<td>Removes all datapoints<td>()<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">clearPoints</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>addBulkPoints<td>Adds multiple datapoints<td>(i1,i2,...)<br>("i1,i2,...")<br>("i1:d1,i2:d2,...")<br>(array(i1,d1),array(i2,d2),...)<br>(array(i1,i2,...)<br>(array(array(i1,d1),array(i2,d2),...))<td>Array of IDs that can be used with delPoint<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">addBulkPoints</span><span style="color: #007700">(</span><span style="color: #0000BB">3</span><span style="color: #007700">,</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #0000BB">4</span><span style="color: #007700">,</span><span style="color: #0000BB">5</span><span style="color: #007700">,</span><span style="color: #0000BB">2</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>delBulkPoints<td>Removes multiple datapoints<td>(id1,id2,...)<br>("id1,id2,...")<br>(array(id1,id2,...))<br>Result of addBulkPoints<td>Array of booleans, true on success, false on failure<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">delBulkPoints</span><span style="color: #007700">(</span><span style="color: #0000BB">$ids</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>graph(constructor)<td>Constructor<td>()<br>(Width,Height)<br>(Width,Height,XScalePoints,YScalePoints)<td>graph object<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">graph</span><span style="color: #007700">(</span><span style="color: #0000BB">100</span><span style="color: #007700">,</span><span style="color: #0000BB">200</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>graph<td>Generates Graph<td>()<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">graph</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>showGraph<td>Makes graph image<td>()<br>("random")<br>(false)<br>("imagesrc")<td>image location<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">showGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"./images/image.png"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>storeGraph<td>Stores entire graph object in a file<td>()<br>("cacheLocation")<br>("cacheLocation","imageCacheLocation")<td>graphFileName<br>array(graphFileName,imageFileName)<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">storeGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"graph.data"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>retriveGraph<td>Retrives graph object set by storeGraph<td>()<br>("cacheLocation")<td>complete graph object<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">retriveGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"graphCache.data"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>retriveImage<td>Retrives graph image set by storeGraph<td>("imageCacheLocation")<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">retriveImage</span><span style="color: #007700">(</span><span style="color: #DD0000">"graphImageCache.data"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table><br><h4>Methods relating to properties:</h4><br>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>setProp<td>Defines a property<td>("name","value")<br>("name","value",dataset)<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"PointImgSrc"</span><span style="color: #007700">,</span><span style="color: #DD0000">"http://site.name/image.type"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>setBulkProp<td>Defines many properties<td>("name:value,name:value,...")<br>("set|name:value,...")<br>("name:value","name:value",...)<br>(array(name,value),array(name,value),...)<br>(array(name,value,set),...)<td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setBulkProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"pOiNtimageSRC:site.scs,ENDstyle:3,color:4-34-122-32"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>getProp<td>Retrives property<td>("name")<br>("name",value to return if not defined)<br>("name",value to return if not defined,dataset)<td>value<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getProp</span><span style="color: #007700">(</span><span style="color: #DD0000">"endstyle"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>getPropArr<td>Retrives entire property array<td>()<td>Property array<td><code><span style="color: #000000">
<span style="color: #0000BB">$arr&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getPropArr</span><span style="color: #007700">();</span><span style="color: #0000BB"></span>
</span>
</code> <tr><td>setPropArr<td>Replaces entire property array<td>(Property array)<td>null<td><code><span style="color: #000000">
<span style="color: #0000BB">$graph</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">setPropArr</span><span style="color: #007700">(</span><span style="color: #0000BB">$arr</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <h4>Methods relating to inline graphing</h4>
 <table><tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>createGraph<td>creates an inline graph<td>("format:data")<br>("format:data",width,height)<br>("format:data",width,height,"name:value,name:value",random)<td>filename of image<td><code><span style="color: #000000">
<span style="color: #0000BB">createGraph</span><span style="color: #007700">(</span><span style="color: #DD0000">"CSV:data.csv:e:d"</span><span style="color: #007700">,</span><span style="color: #0000BB">400</span><span style="color: #007700">,</span><span style="color: #0000BB">100</span><span style="color: #007700">,</span><span style="color: #DD0000">"backcolor:red"</span><span style="color: #007700">,</span><span style="color: #0000BB">true</span><span style="color: #007700">)</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <h4>Methods relating to function graphing</h4>
 <table><tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>graphFunction<td>Graphs a mathmatical function<td>('function',minX,maxX)<br>('function',minX,maxX,dataset)<td>Array for use with delBulkPoints<td><code><span style="color: #000000">
<span style="color: #0000BB">graphFunction</span><span style="color: #007700">(</span><span style="color: #DD0000">"-(arctan($x)*2)/(12*$x)"</span><span style="color: #007700">,</span><span style="color: #0000BB">0</span><span style="color: #007700">,</span><span style="color: #0000BB">10</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <br><h4>Methods relating to color:</h4>
 <table>
 <tr><th>Name<th>Description<th>Accepts<th>Returns<th>Example
 <tr><td>setColor<td>Defines a color property<td>("object",dataset,"color")<br>("object",dataset,r,g,b)<br>("object",dataset,r,g,b,a)<br><td>void<td><code><span style="color: #000000">
<span style="color: #0000BB">setColor</span><span style="color: #007700">(</span><span style="color: #DD0000">"grid"</span><span style="color: #007700">,-</span><span style="color: #0000BB">1</span><span style="color: #007700">,</span><span style="color: #DD0000">"orange"</span><span style="color: #007700">);</span><span style="color: #0000BB"></span>
</span>
</code> </table>
 <br><h4>Internal and development functions:</h4>
 <table>
 <tr><th>Name<th>Description
 <tr><td>strim<td>Type conditional trim
 <tr><td>xScale and yScale<td>Get the proper scaling for a specific data point
 <tr><td>idSearch<td>Find array index for a specific id
 <tr><td>demoData<td>Fill dataset with random data
 <tr><td>error<td>Trigger error
 <tr><td>cacheImg<td>Cache point image after resizing
 <tr><td>multiMax and multiMin<td>Max and Min in 2 dimensional arrays
 <tr><td>internalGraph<td>Actual graphing, called by graph
 <tr><td>roundRect<td>Rectangle with rounded corners, dev
 <tr><td>loadimg<td>Loads images
 <tr><td>aarect<td>Anti-Aliased rectangle, dev
 <tr><td>imageSmoothAlphaLine<td>Smoother lines
 <tr><td>drawArrowheads<td>Draws arrowheads
 <tr><td>flipMulti<td>Flip keys of multidimentional array
 </table>
 <br><br>
 <br><h4>Properties relating to color:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>color<td>Line Color<td>Blue
 <tr><td>backcolor<td>Background Color<td>White
 <tr><td>gridcolor<td>Scale Grid and Number Color<td>Light Gray
 <tr><td>pointcolor<td>Datapoint Color<td>Null
 <tr><td>arrowcolor<td>Line Ending Color<td>Null
 <tr><td>bordercolor<td>Bar Border Color<td>Black
 <tr><td>colorlist<td>List of color arrays used by bar and pie charts<td>Array
 </table>
 <br><h4>Properties relating to points:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>pointstyle<td>The point style<td>0
 <tr><td>pointwidth<td>The width of points<td>5
 <tr><td>pointheight<td>The height of points<td>pointwidth
 <tr><td>pointcolor<td>The color of points<td>line color
 <tr><td>pointimgsrc<td>The location of the point image<td>null
 <tr><td>clearback<td>Don't erase the open area inside the point?<td>false
 </table>
 <br><h5>Point Styles:</h5><br>
 <table>
 <tr><th>Name<th>Description
 <tr style="font-weight:bold"><td>0<td>No Point
 <tr><td>1<td>Filled Rectangle or Square
 <tr><td>2<td>Open Rectangle or Square
 <tr><td>3<td>Filled Triangle
 <tr><td>4<td>Open Triangle
 <tr><td>7<td>Filled Ellipse or Circle
 <tr><td>8<td>Open Ellipse or Circle
 <tr><td>9<td>Image (pointimgsrc must be set)
 </table>
 <br><h5>Arrow Styles:</h5><br>
  <table><tr><th>Name<th>Description
 <tr style="font-weight:bold"><td>0<td>No Arrow
 <tr><td>1<td>Open Arrow
 <tr><td>2<td>Filled Arrow
 </table>
 <br><h4>Properties relating to arrows:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>endstyle<td>The arrow style<td>0
 <tr><td>arrowwidth<td>The width of the arrow<td>25
 <tr><td>arrowangle<td>The angle of the arrow sides<td>14
 <tr><td>arrowcolor<td>The color of the arrow<td>line color
 </table>
 <br><h4>Properties relating to bar charts</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>type<td>What type of graph to create<td>"line"
 <tr><td>barwidth<td>Size of bar, as a decimal of max size<td>1
 <tr><td>barstyle<td>Style of bars, 0 is solid, 1 gradient<td>0
 <tr><td>colorlist<td>Array of arrays of rgb values, will be sequentially applied to bars<td>null
 <tr><td>gstartcolor<td>Beginning color of gradient<td>"white"
 <tr><td>gendcolor<td>End color of gradient<td>"black"
 </table></p>
 <br><h4>Properties relating to pie charts</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>type<td>What type of graph to create<td>"line"
 <tr><td>pieangle<td>Angle of pie<td>35
 <tr><td>useval<td>Use actual value, not percentage for keys<td>false
 <tr><td>colorlist<td>Array of arrays of rgb values, will be sequentially applied to bars<td>12 colors
 <tr><td>numspace<td>Extra spacing between keys and center of graph, in pixels<td>5
 </table>
 <h4>Properties relating to function graphing</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>funcinterval<td>Graph increment per data point<td>.0625
 </table>
 <br><h4>Properties relating to grid and scale:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>autoscl<th>If the program determins the scaling<td>true
 <tr><td>xsclmin<td>The lowest X scale point<td>auto
 <tr><td>xsclmax<td>The greatest X scale point<td>auto
 <tr><td>ysclmin<td>The lowest Y scale point<td>auto
 <tr><td>ysclmax<td>The greatest Y scale point<td>auto
 <tr><td>xsclpts<td>The number of scale points on the X axis<td>10
 <tr><td>ysclpts<td>The number of scale points on the Y axis<td>6
 <tr><td>showgrid<td>If the grid should appear<td>true
 <tr><td>showhorizscale<td>If the horizontal scale should appear<td>true
 <tr><td>showvertscale<td>If the vertical scale should appear<td>true
 <tr><td>sclline<td>The length of each segment of the grid<td>5
 <tr><td>onfreq<td>The amount of each segment of the grid that is on<td>.2
 <tr><td>font<td>The font used to show the numbers<td>arial.ttf
 <tr><td>textsize<td>The size in pt of the text<td>8
 <tr><td>textangle<td>The angle of the text<td>0
 <tr><td>actheight<td>The height of the graph image<td>height+30
 <tr><td>actwidth<td>The width of the graph image<td>width+30
 <tr><td>sort<td>Orders the points<td>true
 </table>
 <br><h4>Properties relating to keys:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>showkey<td>Show keys?<td>false
 <tr><td>keysize<td>Size of the keys<td>10
 <tr><td>keyfont<td>Font of the keys<td>"arial"
 <tr><td>keyinfo<td>What information is shown in the key<td>0
 <tr><td>keywidspc<td>Space between graph and left side of key<td>10
 </table>
 <br><b>Possible values for the keyinfo property</b>
 <br><br><table>
 <tr><td>0<td>No Information Beyond Name
 <tr><td>1<td>Percentage
 <tr><td>2<td>Actual Value
 <tr><td>3<td>Both
 </table>
 <br><h4>Properties relating to inline graphing</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>tempfolder<td>Folder prefix of images to be created (with trailing \)<td>""
 <tr><td>delold<td>If old images should be deleted using random<td>true
 <tr><td>cachehistory<td>How many images to keep at once when using delold<td>4
 </table>
 <br><h4>Properties relating to titles and labels:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>title<td>Title String<td>none
 <tr><td>xlabel<td>X Axis Label String<td>none
 <tr><td>ylabel<td>Y Axis Label String<td>none
 <tr><td>titlesize<td>The size of the title<td>24
 <tr><td>labelsize<td>The size of the labels<td>14
 <tr><td>labelcolor<td>The colors of the labels<td>black
 </table>
 <br><h4>Properties relating to keys:</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>scale<td>What type of keys to use<td>"numeric"
 <tr><td>dateformat<td>How to format the dates<td>1
 <tr><td>xincpts<td>The number of keys to show<td>10
 <tr><td>showyear<td>If years should be shown in dates<td>auto
 </table>
 <br><h4>dateformat Values</h4>
 <table><tr><th>Value<th>Month Format<th>Year Format
 <tr><td>1<td>3 char<td>2 digit
 <tr><td>2<td>3 char<td>4 digit
 <tr><td>3<td>full<td>2 digit
 <tr><td>4<td>fill<td>4 digit
 </table>
 <br><h4>Properties relating to errors</h4>
 <table>
 <tr><th>Name<th>Description<th>Default Value
 <tr><td>production<td>Hide errors?<td>false
 <tr><td>benchmark<td>Display how long it took to generate graph?<td>false
 </table>
 <br><h4>Properties relating to output</h4>
 <table><tr><th>Name<th>Description<th>Default Value
 <tr><td>noheader<td>Determins if the image header is sent when displaying the graph directly to the page<td>false
 <tr><td>imagepre<td>Prefix to use in default and generated image names (must include trailing /)<td>""
 </table>
 <h3><a name="12">12. development Information:</h3>
 <p>
 Please report <b>any</b> bugs and send <b>any</b> suggestions to <a href="mailto:hide@address.com">hide@address.com</a>. I really love to hear both.
 </p>
 <p>Really want a feature? Guilt me into making it by donating:
 <br>
 <form action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="image" src="https://www.paypal.com/en_US/i/btn/x-click-but04.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<img alt="" border="0" src="https://www.paypal.com/en_US/i/scr/pixel.gif" width="1" height="1">
<input type="hidden" name="encrypted" value="-----BEGIN PKCS7-----MIIHkAYJKoZIhvcNAQcEoIIHgTCCB30CAQExggEwMIIBLAIBADCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwDQYJKoZIhvcNAQEBBQAEgYA09/vCEg1aSuaa8TUd5yMdbULtCF/F3Pi/owpMNMT52fiVmwpBjLid+8Jmy6E4UvLaHLfODzv5UPvFcCClf7jSJGuti784KP9ndZZP+T9CtQrfLo3DeQpq1fj5rylW+8LqIsey6+dsFPqFSpv9lV7JSQ0yRQG/XENQx1rhWroeGTELMAkGBSsOAwIaBQAwggEMBgkqhkiG9w0BBwEwFAYIKoZIhvcNAwcECBhZiuxGPWj6gIHofsr58cO1GIU5a9ZmoG8vuexPz4AWLhZL4bGRFcyoXOEBuVNSPKOhLE8h+P8AQzjO41LxyFqN1Q/vyy6BDgzxM28wEs5Us4gfksufF/NK+70t0OxnuY63zttp9/gjxWbtwS+G8eYJMWztYDUrw/1G6EWbW1MztnEeKRQTjlfei7r9HKwz4LZB7TJyfXwM+hjgE7JWbAJQynIa90hpTdf5TyW3CBrZToJsgKWHxuKiootA2dubrlRJnisLV0ARB5pBAR/+/FG2xUFIhd1wHvFtyjvtNNDYJ0bAMspA1Tx8/rqaTAn7uLv3fqCCA4cwggODMIIC7KADAgECAgEAMA0GCSqGSIb3DQEBBQUAMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTAeFw0wNDAyMTMxMDEzMTVaFw0zNTAyMTMxMDEzMTVaMIGOMQswCQYDVQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxFDASBgNVBAoTC1BheVBhbCBJbmMuMRMwEQYDVQQLFApsaXZlX2NlcnRzMREwDwYDVQQDFAhsaXZlX2FwaTEcMBoGCSqGSIb3DQEJARYNcmVAcGF5cGFsLmNvbTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAwUdO3fxEzEtcnI7ZKZL412XvZPugoni7i7D7prCe0AtaHTc97CYgm7NsAtJyxNLixmhLV8pyIEaiHXWAh8fPKW+R017+EmXrr9EaquPmsVvTywAAE1PMNOKqo2kl4Gxiz9zZqIajOm1fZGWcGS0f5JQ2kBqNbvbg2/Za+GJ/qwUCAwEAAaOB7jCB6zAdBgNVHQ4EFgQUlp98u8ZvF71ZP1LXChvsENZklGswgbsGA1UdIwSBszCBsIAUlp98u8ZvF71ZP1LXChvsENZklGuhgZSkgZEwgY4xCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLUGF5UGFsIEluYy4xEzARBgNVBAsUCmxpdmVfY2VydHMxETAPBgNVBAMUCGxpdmVfYXBpMRwwGgYJKoZIhvcNAQkBFg1yZUBwYXlwYWwuY29tggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAgV86VpqAWuXvX6Oro4qJ1tYVIT5DgWpE692Ag422H7yRIr/9j/iKG4Thia/Oflx4TdL+IFJBAyPK9v6zZNZtBgPBynXb048hsP16l2vi0k5Q2JKiPDsEfBhGI+HnxLXEaUWAcVfCsQFvd2A1sxRr67ip5y2wwBelUecP3AjJ+YcxggGaMIIBlgIBATCBlDCBjjELMAkGA1UEBhMCVVMxCzAJBgNVBAgTAkNBMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtQYXlQYWwgSW5jLjETMBEGA1UECxQKbGl2ZV9jZXJ0czERMA8GA1UEAxQIbGl2ZV9hcGkxHDAaBgkqhkiG9w0BCQEWDXJlQHBheXBhbC5jb20CAQAwCQYFKw4DAhoFAKBdMBgGCSqGSIb3DQEJAzELBgkqhkiG9w0BBwEwHAYJKoZIhvcNAQkFMQ8XDTA2MDUxMzE4NDUyNVowIwYJKoZIhvcNAQkEMRYEFPxgrPYCPhyJX3Ft6pfMy31NMvd4MA0GCSqGSIb3DQEBAQUABIGAqz0TI+MVHtb0on8q8wInllb1S5z3o/T0hbNiJ+GI/gqi+Ka69dfN80SFzzkfaV/7Jc+PTHfOYlTJkTCkrp4f1wY4FBwc8WFdkzVEKAe3T0yxDT58WoatB5+OGuTDrYkJxynpIAd0wmvejfA3WBKOvFgroWN/aSLUmwJA9IC3XjI=-----END PKCS7-----
">
</form>
 </p>
 <p>
 Please send any bug reports with a print_r of the graph object if possible.<br>
 Works with PHP5 with GD and TTF support.<br>
 Developed by Zack Bloom<br>
 <h5>Licence</h5>
 You can do what ever you want with the code, copy all or part, impress girlfriends with your l33t programming skillz, say you wrote it, whatever.
 The only condition is, and I'm serious about this, if you use it in any commercial applications you must give me a free copy.
 But I must say it is much more gratifying to write the code yourself (unless it actually takes effort like the AA lines or arrow heads that I stole functions for, then steal away).
 You don't even have to give me credit, just send me a link to any thing cool you make, hide@address.com
 </p>
 <p>I need to feel loved, send me a link to anything you make: hide@address.com
 </p>
 <p>
 <h4>ToDo List:</h4>
 <ul>
 <li style="text-decoration: line-through">Pie and bar graph support.
 <li style="text-decoration: line-through">Support for horizontal labels.
 <li style="text-decoration: line-through">Header, X axis and Y axis labels.
 <li style="text-decoration: line-through">Function graphing.
 <li style="text-decoration: line-through">Support for javascript div output.
 <li>Horizontal bar graphs.
 <li>Support for animated graph flash output.
 <li>Support for user settable line width.
 <li>Support for animated div output.
 <li style="text-decoration: line-through">Support for multiple datasets in one XML file.
 <li>Support for SVG output.
 </ul>
 </p>
</div>
</body></html>
Return current item: Advanced Graphing Class