Código PHP:
<?
//Llamamos la libreria dependiendo del tipo de grafico
include ("C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph.php");
include ("C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph_pie.php");
include ("C://apachefriends//xampp//htdocs//estadisticas//jpgraph//jpgraph_pie3d.php");
//Conexion via ODBC con MsAccess
$db = odbc_connect("test","","","");
$sql= odbc_exec($db,"select Name,Marks from students");
$data = array();
//Recorremos los registros de la tabla especifica
while($row = odbc_fetch_array($sql)) {
//$data es el registro que queremos graficar
$data[] = $row[Marks];
$leg[] = $row[Name];
}
$graph = new PieGraph(300,200,"auto");
$graph->SetShadow();
$graph->title->Set("JpGraph & Access Via ODBC");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$p1 = new PiePlot3D($data);
$p1->SetSize(.2);
$p1->SetCenter(0.40);
$p1->SetAngle(45);
$p1->SetLabelType(PIE_VALUE_ABS);
$p1->value->SetFont(FF_FONT1,FS_BOLD);
$p1->value->SetColor("red");
$p1->value->SetFormat('%d Puntos');
$p1->value->Show();
$p1->ExplodeAll(5);
$p1->SetLegends($leg);
$graph->Add($p1);
$graph->Stroke();
?>