Name | Description |
---|---|
graph.oo.php | Loads advgraph4.class.php or advgraph5.class.php depending on PHP version. |
advgraph4.class.php | Class designed for PHP4. |
advgraph5.class.php | Class designed for PHP5. |
test.php | Testing file. Open this on your browser to check your servers compatibility and test the class. |
arial.ttf | Default font file. |
wz_jsgraphics.js | Optional file required to output graphs as HTML. |
examples-static.html | Static version of the example page. You should use the version on zackbloom.org if possible. |
readme-static.html | Static version of the readme page. You should use the version on zackbloom.org if possible. |
images\ | Contains the images used by the example and test pages. |
include "graph.oo.php";
.
$graph = new graph();
.
$graph->addPoint(5);
. Make up some numbers and add 5 points.
$graph->graph();
.
$graph->showGraph();
.
<?php
include "graph.oo.php";
$graph = new graph();
$graph->addPoint(1);
$graph->addPoint(4);
$graph->addPoint(5);
$graph->addPoint(2);
$graph->addPoint(3);
$graph->graph();
$graph->showGraph("test.png");
?>
$graph = new graph([[[[Width],Height],X Scale Increments],Y Scale Increments]);
$graph->addPoint(dependent[[,independent],dataset]);
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. If you are using a date based scale and wish to use a date for the independent var begin the date with d: so it can be converted; For example:
<?$graph->addPoint(1, "d:May 2007");?>
1.
$graph->addPoint(1,2,1);
.
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.
If you don't include the independent var like
$graph->addPoint(5);
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
$graph->addPoint(4,1)
you can use decimal or integer values for both of the properties.
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.
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:
$graph->graph();
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,
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.
$graph->storeGraph("./cache/graph.data","./cache/image.data");
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:
$graph = new graph();
//Set some properties and datapoints
$graph->storeGraph("datafile","imagefile");
//Later when you need to retrive it:
$graph = new graph();
$graph = $graph->retriveGraph("datafile"); //You must set it equal to graph.
$graph->retriveImage("imagefile");
$graph->showGraph(); //Just like normal
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
addPoint | Adds a datapoint | (independent) (independent,dependent) (array(independent,dependent)) | ID that can be used with delPoint |
$graph->addPoint(2,4);
|
delPoint | Removes a datapoint | (id) (0,index) | true on success, false on failure |
$graph->delPoint($id);
|
clearPoints | Removes all datapoints | () | void |
$graph->clearPoints();
|
addBulkPoints | Adds multiple datapoints | (i1,i2,...) ("i1,i2,...") ("i1:d1,i2:d2,...") (array(i1,d1),array(i2,d2),...) (array(i1,i2,...) (array(array(i1,d1),array(i2,d2),...)) | Array of IDs that can be used with delPoint |
$graph->addBulkPoints(3,1,4,5,2);
|
delBulkPoints | Removes multiple datapoints | (id1,id2,...) ("id1,id2,...") (array(id1,id2,...)) Result of addBulkPoints | Array of booleans, true on success, false on failure |
$graph->delBulkPoints($ids);
|
graph(constructor) | Constructor | () (Width,Height) (Width,Height,XScalePoints,YScalePoints) | graph object |
$graph = new graph(100,200)
|
graph | Generates Graph | () | void |
$graph->graph();
|
showGraph | Makes graph image | () ("random") (false) ("imagesrc") | image location |
$graph->showGraph("./images/image.png");
|
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:
$graph->setProp(name,value,[dataset]);
So you would use
$graph->setProp("pointwidth",5)
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,
$graph->setBulkProp("color:red-green-blue-alpha,2|pointstyle:3,backcolor:24-122-255,1|color:blue");
. 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.
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:
$graph->getProp("endstyle",2);
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.
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:
setProp("pointheight",10,2); or setBulkProp("2|pointheight:10");
. Always go in numerical order when using datasets.
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.
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
setProp | Defines a property | ("name","value") ("name","value",dataset) | void |
$graph->setProp("PointImgSrc","http://site.name/image.type");
|
setBulkProp | Defines many properties | ("name:value,name:value,...") ("set|name:value,...") ("name:value","name:value",...) (array(name,value),array(name,value),...) (array(name,value,set),...) | void |
$graph->setBulkProp("pOiNtimageSRC:site.scs,ENDstyle:3,color:4-34-122-32");
|
getProp | Retrives property | ("name") ("name",value to return if not defined) ("name",value to return if not defined,dataset) | value |
$graph->getProp("endstyle");
|
getPropArr | Retrives entire property array | () | Property array |
$arr = $graph->getPropArr();
|
setPropArr | Replaces entire property array | (Property array) | null |
$graph->setPropArr($arr);
|
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:
$graph->setColor("backcolor",-1,"red"); or $graph->setColor("gridcolor",-1,233,3,122); or $graph->setColor("color",-1,122,4,13,32);
The accepted color strings are "red","green","blue","teal","orange","pink","purple","yellow","white","lightgray","darkgray" and "black".
Name | Description | Default Value |
---|---|---|
color | Line Color | Blue |
backcolor | Background Color | White |
gridcolor | Scale Grid and Number Color | Light Gray |
pointcolor | Datapoint Color | Null |
arrowcolor | Line Ending Color | Null |
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
setColor | Defines a color property | ("object",dataset,"color") ("object",dataset,r,g,b) ("object",dataset,r,g,b,a) | void |
setColor("grid",-1,"orange");
|
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:
Name | Description |
---|---|
0 | No Point |
1 | Filled Rectangle or Square |
2 | Open Rectangle or Square |
3 | Filled Triangle |
4 | Open Triangle |
7 | Filled Ellipse or Circle |
8 | Open Ellipse or Circle |
9 | Image (pointimgsrc must be set) |
Name | Description | Default Value |
---|---|---|
pointstyle | The point style | 0 |
pointwidth | The width of points | 5 |
pointheight | The height of points | pointwidth |
pointcolor | The color of points | line color |
pointimgsrc | The location of the point image | null |
clearback | Don't erase the open area inside the point? | false |
The endstyle defines if an arrow is used to end the graph.
These are the valid arrow styles:
Name | Description |
---|---|
0 | No Arrow |
1 | Open Arrow |
2 | Filled Arrow |
Name | Description | Default Value |
---|---|---|
endstyle | The arrow style | 0 |
arrowwidth | The width of the arrow | 25 |
arrowangle | The angle of the arrow sides | 14 |
arrowcolor | The color of the arrow | line color |
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.
Name | Description | Default Value |
---|---|---|
autoscl | If the program determins the scaling | true |
xsclmin | The lowest X scale point | auto |
xsclmax | The greatest X scale point | auto |
ysclmin | The lowest Y scale point | auto |
ysclmax | The greatest Y scale point | auto |
xsclpts | The number of scale points on the X axis | 10 |
ysclpts | The number of scale points on the Y axis | 6 |
showgrid | If the grid should appear | true |
showhorizscale | If the horizontal scale should appear | true |
showvertscale | If the vertical scale should appear | true |
sclline | The length of each segment of the grid | 5 |
onfreq | The amount of each segment of the grid that is on | .2 |
font | The font used to show the numbers | arial.ttf |
textsize | The size in pt of the text | 8 |
textangle | The angle of the text | 0 |
actheight | The height of the graph image | height+30 |
actwidth | The width of the graph image | width+30 |
sort | Orders the points | true |
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:
Value | Month Format | Year Format |
---|---|---|
1 | 3 char | 2 digit |
2 | 3 char | 4 digit |
3 | full | 2 digit |
4 | full | 4 digit |
Name | Description | Default Value |
---|---|---|
scale | What type of keys to use | "numeric" |
dateformat | How to format the dates | 1 |
xincpts | The number of keys to show | 10 |
showyear | If years should be shown in dates | auto |
rounddateto | If set to 'month' will round date to closest month | false |
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. Possible values for the keyinfo property
0 | No Information Beyond Name |
1 | Percentage |
2 | Actual Value |
3 | Both |
<?
$graph->setProp("key","alpha",0);
$graph->setProp("key","beta",1);
$graph->setProp("key","delta",2);
?>
OR
<?
$graph->setBulkProps("0|key:alpha,1|key:beta,2|key:delta");
?>
For pie and bar charts you set the key property to an array of names:
<?
$graph->setProp("key",array("alpha","beta","delta"));
?>
Name | Description | Default Value |
---|---|---|
showkey | Show keys? | false |
keysize | Size of the keys | 10 |
keyfont | Font of the keys | "arial" |
keyinfo | What information is shown in the key | 0 |
keywidspc | Space between graph and left side of key | 10 |
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.
Name | Description | Default Value |
---|---|---|
title | Title String | none |
xlabel | X Axis Label String | none |
ylabel | Y Axis Label String | none |
titlesize | The size of the title | 24 |
labelsize | The size of the labels | 14 |
labelcolor | The colors of the labels | black |
Name | Description | Default Value |
---|---|---|
production | Hide errors? | false |
$graph->importCSV("file"[,"format"[,default dataset]]);
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:
importCSV("file.loc","i") or importCSV("file.loc","d,i",2) or importCSV("file.loc","d,i,l")
Commas must be used.
So in this file:
$graph->importXML("file"[,"independent"[,"dependent"[,"block"[,dataset attribute]]]]);
The file is the file to be imported. Independent, dependent and block are the tags used for each in the file. In this file:
<data>
<point set=0>
<i>1</i>
<d>4</d>
</point>
<point set=0>
<i>3</i>
<d>6</d>
</point>
<point set=0>
<i>2</i>
<d>3</d>
</point>
<point set=0>
<i>4</i>
<d>5</d>
</point>
<point set=0>
<i>3</i>
<d>5</d>
</point>
</data>
<?$graph->importMySQL("table","field",resource or "database",["user",["password",["server",[frequency]]]])?>
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:
<?
$m = mysql_connect("server","username","password");
mysql_select_db("database",$m);
$graph->importMySQL("table","field",$m);
?>
1 The class will graph the frequency of the values appearing in the database, see the example page.
The method used to make the CSV and XML graphs above is the inline format. For example the XML graph's code is:
<img src="<?=createGraph("XML:testdata.xml",200,100)?>">
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::. You do not need to create the graph object:
graph::createGraph("data",width,height,"properties",random)
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.
For XML or CSV:
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.
For RAW:
Enter data just as you would if you were using the addBulkPoints function, except you use a ; (semicolon) where you would use a : (colon).
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.
graph::createGraph("RAW:1;3,2;4,1;6,1|3;2,1|8;7,1|2;3",200,100,"0|color:blue,1|color:green,sort:true")
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
createGraph | creates an inline graph | ("format:data") ("format:data",width,height) ("format:data",width,height,"name:value,name:value",random) | filename of image |
createGraph("CSV:data.csv:e:d",400,100,"backcolor:red",true)
|
Name | Description | Default Value |
---|---|---|
tempfolder | Folder prefix of images to be created (with trailing \) | "" |
delold | If old images should be deleted using random | true |
cachehistory | How many images to keep at once when using delold | 4 |
Name | Description | Default Value |
---|---|---|
type | What type of graph to create | "line" |
barwidth | Size of bar, as a decimal of max size | 1 |
barstyle | Style of bars, 0 is solid, 1 gradient | 0 |
colorlist | Array of arrays of rgb values, will be sequentially applied to bars, true will use default values | null |
gstartcolor | Beginning color of gradient | "white" |
gendcolor | End color of gradient | "black" |
Name | Description | Default Value |
---|---|---|
type | What type of graph to create | "line" |
pieangle | Angle of pie | 35 |
useval | Use actual value, not percentage for keys | false |
colorlist | Array of arrays of rgb values, will be sequentially applied to bars | 12 colors |
numspace | Extra spacing between keys and center of graph, in pixels | 5 |
$graph->graphFunction(function,minX,maxX[,dataset]);
Name | Description | Accepts | Returns | Example | |||||
---|---|---|---|---|---|---|---|---|---|
graphFunction | Graphs a mathmatical function | ('function',minX,maxX) ('function',minX,maxX,dataset) | Array for use with delBulkPoints | graphFunction("-(arctan(x)*2)/(12x)",0,10);
|
Name | Description | Default Value |
---|---|---|
funcinterval | Graph increment per data point | .0625 |
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:
Argument | Description | Best Use |
---|---|---|
true or nothing | Displays the graph onto the page, with the png header (if noheader is not false) | Sending the image to the browser directly, without an html page |
false | Stores the image in a file called graphImage.png, prefixed with the imagepre property, if set | Normal no-frills output |
"random" | Stores the image in a file called graphImage<random number>.png, prefixed with the imagepre property, if set | AJAX applications or where caching is a problem |
any other string | Stores the image to the string passed to it | Specialized output or multiple graphs on one page (without using the inline method where this is handled automatically) |
The method will return the filename or true if the graph was sent to the page directly.
Name | Description | Default Value |
---|---|---|
noheader | Determins if the image/png header is sent when displaying the graph directly to the page | false |
imagepre | Prefix to use in default and generated image names (must include trailing /) | "" |
<html><head>
<?php
include("graph.oo.php");
$graph = new graph(400,200,6,10,"div","graph");
?>
</head><body>
<div id="graph"></div>
<?php
//Points
$graph->graph();
$graph->showGraph();
?>
</body></html>
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
addPoint | Adds a datapoint | (independent) (independent,dependent) (array(independent,dependent)) | ID that can be used with delPoint |
$graph->addPoint(2,4);
|
delPoint | Removes a datapoint | (id) (0,index) | true on success, false on failure |
$graph->delPoint($id);
|
clearPoints | Removes all datapoints | () | void |
$graph->clearPoints();
|
addBulkPoints | Adds multiple datapoints | (i1,i2,...) ("i1,i2,...") ("i1:d1,i2:d2,...") (array(i1,d1),array(i2,d2),...) (array(i1,i2,...) (array(array(i1,d1),array(i2,d2),...)) | Array of IDs that can be used with delPoint |
$graph->addBulkPoints(3,1,4,5,2);
|
delBulkPoints | Removes multiple datapoints | (id1,id2,...) ("id1,id2,...") (array(id1,id2,...)) Result of addBulkPoints | Array of booleans, true on success, false on failure |
$graph->delBulkPoints($ids);
|
graph(constructor) | Constructor | () (Width,Height) (Width,Height,XScalePoints,YScalePoints) | graph object |
$graph = new graph(100,200)
|
graph | Generates Graph | () | void |
$graph->graph();
|
showGraph | Makes graph image | () ("random") (false) ("imagesrc") | image location |
$graph->showGraph("./images/image.png");
|
storeGraph | Stores entire graph object in a file | () ("cacheLocation") ("cacheLocation","imageCacheLocation") | graphFileName array(graphFileName,imageFileName) |
$graph->storeGraph("graph.data");
|
retriveGraph | Retrives graph object set by storeGraph | () ("cacheLocation") | complete graph object |
$graph = $graph->retriveGraph("graphCache.data");
|
retriveImage | Retrives graph image set by storeGraph | ("imageCacheLocation") | void |
$graph->retriveImage("graphImageCache.data");
|
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
setProp | Defines a property | ("name","value") ("name","value",dataset) | void |
$graph->setProp("PointImgSrc","http://site.name/image.type");
|
setBulkProp | Defines many properties | ("name:value,name:value,...") ("set|name:value,...") ("name:value","name:value",...) (array(name,value),array(name,value),...) (array(name,value,set),...) | void |
$graph->setBulkProp("pOiNtimageSRC:site.scs,ENDstyle:3,color:4-34-122-32");
|
getProp | Retrives property | ("name") ("name",value to return if not defined) ("name",value to return if not defined,dataset) | value |
$graph->getProp("endstyle");
|
getPropArr | Retrives entire property array | () | Property array |
$arr = $graph->getPropArr();
|
setPropArr | Replaces entire property array | (Property array) | null |
$graph->setPropArr($arr);
|
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
createGraph | creates an inline graph | ("format:data") ("format:data",width,height) ("format:data",width,height,"name:value,name:value",random) | filename of image |
createGraph("CSV:data.csv:e:d",400,100,"backcolor:red",true)
|
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
graphFunction | Graphs a mathmatical function | ('function',minX,maxX) ('function',minX,maxX,dataset) | Array for use with delBulkPoints |
graphFunction("-(arctan($x)*2)/(12*$x)",0,10);
|
Name | Description | Accepts | Returns | Example |
---|---|---|---|---|
setColor | Defines a color property | ("object",dataset,"color") ("object",dataset,r,g,b) ("object",dataset,r,g,b,a) | void |
setColor("grid",-1,"orange");
|
Name | Description |
---|---|
strim | Type conditional trim |
xScale and yScale | Get the proper scaling for a specific data point |
idSearch | Find array index for a specific id |
demoData | Fill dataset with random data |
error | Trigger error |
cacheImg | Cache point image after resizing |
multiMax and multiMin | Max and Min in 2 dimensional arrays |
internalGraph | Actual graphing, called by graph |
roundRect | Rectangle with rounded corners, dev |
loadimg | Loads images |
aarect | Anti-Aliased rectangle, dev |
imageSmoothAlphaLine | Smoother lines |
drawArrowheads | Draws arrowheads |
flipMulti | Flip keys of multidimentional array |
Name | Description | Default Value |
---|---|---|
color | Line Color | Blue |
backcolor | Background Color | White |
gridcolor | Scale Grid and Number Color | Light Gray |
pointcolor | Datapoint Color | Null |
arrowcolor | Line Ending Color | Null |
bordercolor | Bar Border Color | Black |
colorlist | List of color arrays used by bar and pie charts | Array |
Name | Description | Default Value |
---|---|---|
pointstyle | The point style | 0 |
pointwidth | The width of points | 5 |
pointheight | The height of points | pointwidth |
pointcolor | The color of points | line color |
pointimgsrc | The location of the point image | null |
clearback | Don't erase the open area inside the point? | false |
Name | Description |
---|---|
0 | No Point |
1 | Filled Rectangle or Square |
2 | Open Rectangle or Square |
3 | Filled Triangle |
4 | Open Triangle |
7 | Filled Ellipse or Circle |
8 | Open Ellipse or Circle |
9 | Image (pointimgsrc must be set) |
Name | Description |
---|---|
0 | No Arrow |
1 | Open Arrow |
2 | Filled Arrow |
Name | Description | Default Value |
---|---|---|
endstyle | The arrow style | 0 |
arrowwidth | The width of the arrow | 25 |
arrowangle | The angle of the arrow sides | 14 |
arrowcolor | The color of the arrow | line color |
Name | Description | Default Value |
---|---|---|
type | What type of graph to create | "line" |
barwidth | Size of bar, as a decimal of max size | 1 |
barstyle | Style of bars, 0 is solid, 1 gradient | 0 |
colorlist | Array of arrays of rgb values, will be sequentially applied to bars | null |
gstartcolor | Beginning color of gradient | "white" |
gendcolor | End color of gradient | "black" |
Name | Description | Default Value |
---|---|---|
type | What type of graph to create | "line" |
pieangle | Angle of pie | 35 |
useval | Use actual value, not percentage for keys | false |
colorlist | Array of arrays of rgb values, will be sequentially applied to bars | 12 colors |
numspace | Extra spacing between keys and center of graph, in pixels | 5 |
Name | Description | Default Value |
---|---|---|
funcinterval | Graph increment per data point | .0625 |
Name | Description | Default Value |
---|---|---|
autoscl | If the program determins the scaling | true |
xsclmin | The lowest X scale point | auto |
xsclmax | The greatest X scale point | auto |
ysclmin | The lowest Y scale point | auto |
ysclmax | The greatest Y scale point | auto |
xsclpts | The number of scale points on the X axis | 10 |
ysclpts | The number of scale points on the Y axis | 6 |
showgrid | If the grid should appear | true |
showhorizscale | If the horizontal scale should appear | true |
showvertscale | If the vertical scale should appear | true |
sclline | The length of each segment of the grid | 5 |
onfreq | The amount of each segment of the grid that is on | .2 |
font | The font used to show the numbers | arial.ttf |
textsize | The size in pt of the text | 8 |
textangle | The angle of the text | 0 |
actheight | The height of the graph image | height+30 |
actwidth | The width of the graph image | width+30 |
sort | Orders the points | true |
Name | Description | Default Value |
---|---|---|
showkey | Show keys? | false |
keysize | Size of the keys | 10 |
keyfont | Font of the keys | "arial" |
keyinfo | What information is shown in the key | 0 |
keywidspc | Space between graph and left side of key | 10 |
0 | No Information Beyond Name |
1 | Percentage |
2 | Actual Value |
3 | Both |
Name | Description | Default Value |
---|---|---|
tempfolder | Folder prefix of images to be created (with trailing \) | "" |
delold | If old images should be deleted using random | true |
cachehistory | How many images to keep at once when using delold | 4 |
Name | Description | Default Value |
---|---|---|
title | Title String | none |
xlabel | X Axis Label String | none |
ylabel | Y Axis Label String | none |
titlesize | The size of the title | 24 |
labelsize | The size of the labels | 14 |
labelcolor | The colors of the labels | black |
Name | Description | Default Value |
---|---|---|
scale | What type of keys to use | "numeric" |
dateformat | How to format the dates | 1 |
xincpts | The number of keys to show | 10 |
showyear | If years should be shown in dates | auto |
Value | Month Format | Year Format |
---|---|---|
1 | 3 char | 2 digit |
2 | 3 char | 4 digit |
3 | full | 2 digit |
4 | fill | 4 digit |
Name | Description | Default Value |
---|---|---|
production | Hide errors? | false |
benchmark | Display how long it took to generate graph? | false |
Name | Description | Default Value |
---|---|---|
noheader | Determins if the image header is sent when displaying the graph directly to the page | false |
imagepre | Prefix to use in default and generated image names (must include trailing /) | "" |
Please report any bugs and send any suggestions to zackbloom@gmail.com. I really love to hear both.
Really want a feature? Guilt me into making it by donating:
Please send any bug reports with a print_r of the graph object if possible.
Works with PHP 4 & 5 with GD and TTF support.
Developed by Zack Bloom
I need to feel loved, send me a link to anything you make: zackbloom@gmail.com