Graphs in PHP

Fusion Chart :-

The link is

http://www.fusioncharts.com/free/download/

One has to register there. No charges applied. Just give the name and email id and it will redirect to the download page. This contains demos with source code and a very useful manual.

Here one just have to include 2 class files present in (FusionChartsFree/Fusion_Charts/Code/PHP/Includes ) i.e. FC_Colors.php( For assigning different colors to the graph ) and FusionCharts.php( For creating animated graphs ). Then include the javascript file FusionCharts.js (FusionChartsFree/Fusion_Charts/FusionCharts ) and then include those swf files ( FusionChartsFree/Fusion_Charts/FusionCharts ) . These swf files are ShockWave flash files for animation.Fusion chart convert the xml data into the graph. So the data should be in xml format.

Then in your page write the below code :-

/* Creates an array for the data */

$arrData[0][1] = “Product A”; $arrData[1][1] = “Product B”; $arrData[2][1] = “Product C”; $arrData[3][1] = “Product D”; $arrData[4][1] = “Product E”;

$arrData[5][1] = “Product F”;

//Store sales data
$arrData[0][2] = 567500; $arrData[1][2] = 815300; $arrData[2][2] = 556800; $arrData[3][2] = 734500;

$arrData[4][2] = 676800;

$arrData[5][2] = 648500;

//Now, we need to convert this data into XML. We convert using string concatenation.
//Initialize element
$strXML = “”;
//Convert data to XML and append

foreach ($arrData as $arSubData)
$strXML .= “

150 150 Burnignorance | Where Minds Meet And Sparks Fly!