huh? whats so hard with jpgraph. i have never used it am new to php and managed to create some nice graphs with it. look here
http://www.phpfreaks.com/tutorials/112/0.php
http://www.phpfreaks.com/tutorials/115/0.php
http://www.stargeek.com/item/14831.html
basically for the values in the graph you need an array of values like shown in any jpgraph example. just make sure sure its a intreger or float value cause jpgrah doesnt like it when there are string numbers. you might need to convert them to ints. try to see if you can get a simple graph working first like shown in the tutorial! if that works play around a bit. then check the included jpgrah examples and look at the code there and play around a bit
this is my graph. kinda complicated with all the arrays and conversions. took me 3 days to figure out how to use jpgrah
<?php
//dont leave any space between the php headers
//includes
include ("../jpgraph/jpgraph.php");
include ("../jpgraph/jpgraph_bar.php");
include ("general.php");
include ("dump.php");
// Callback function for Y-scale
function yScaleCallback($aVal) {
return number_format($aVal);
}
$arraysize = count($_SESSION['invoicetotal']); //to get array size
//to convert total to a pure number for jpgraph
$adder = 0;
foreach(($_SESSION['invoicetotal']) as $value){
$temp = str_replace(",", "", $value);
$money[$adder] = (float) $temp;
$adder++;
}
$dates = ($_SESSION['invoicedate']);
$title = ($_SESSION['title']);
$subtitle = ($_SESSION['subtitle']);
$accounts = ($_SESSION['Account_no']);
$providers = $_SESSION['Provider'];
$arraysize = count($money);
//to make the graph size bigger if necessary
$graphsize = 460;
for ($b=1; $b < $arraysize; $b++){
$graphsize += 120;
}
// Create the graph and setup the basic parameters
$graph = new Graph($graphsize,500,'Graph.jpeg',1);
$graph->img->SetImgFormat("jpeg");
$graph->img->SetQuality(100);
$graph->img->SetMargin(85,30,40,120);
$graph->SetScale("textint");
$graph->title->Set($title);
$graph->title->SetFont(FF_ARIAL,FS_BOLD,13);
$graph->title->SetMargin(20);
$graph->subtitle->Set($subtitle);
$graph->subtitle->SetMargin(10);
$graph->subtitle->SetFont(FF_ARIAL,FS_BOLD,10);
//create the plot
$bplot = new BarPlot($money);
$bplot->SetFillColor("navy");
$bplot->SetFillGradient("navy","lightsteelblue",GRAD_VER); //gradient colours
$bplot->value->Show(); //make the values show for each bar
$bplot->value->SetFont(FF_ARIAL,FS_BOLD);
$bplot->value->SetAngle(45);
$bplot->value->SetFormat('£ %0.0f');
$bplot->SetShadow();
$graph->yaxis->scale->SetGrace(10); //space between highest value bar and end of graph
$graph->yaxis->SetFont(FF_ARIAL);
$graph->yaxis->title->SetFont(FF_ARIAL,FS_BOLD,10);
$graph->yaxis->SetLabelFormat('£ %0.0f');
$graph->yaxis->title->Set('Total In Pounds');
$graph->yaxis->SetTitleMargin(64);
$graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5');
$graph->ygrid->Show();
//to create the ticks lables
for ($i=0;$i<$arraysize;$i++){
$xaxisarray[$i] = $dates[$i]."\n".$providers[$i]."\n".$accounts[$i];
}
$graph->xaxis->SetTickLabels($xaxisarray); //set tick lables
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,9);
$graph->xaxis->title->Set("Date, Provider, Account No");
$graph->xaxis->title->SetFont(FF_ARIAL,FS_NORMAL,9);
$graph->xaxis->SetTitleMargin(55);
$graph->SetMarginColor('white');
$graph->SetShadow();
$graph->Add($bplot);
$graph->Stroke();
?>