Hola omar_gutierrez, te pongo un script que yo uso donde trabajo jpgraph con base de datos (mysql) donde te graficara dependiendo de lo que trengas en la base de datos, espero te sirva
Código PHP:
Ver original<?php
include("conex.php");
include("jpgraph/src/jpgraph.php");
include("jpgraph/src/jpgraph_pie.php");
include("jpgraph/src/jpgraph_pie3d.php");
$query = mysql_query("SELECT votos,candidato FROM encuesta");
{
$data[] = $row[0];
$can[] = $row[1];
}
$graph = new PieGraph(550,300,"auto");
$graph->img->SetAntiAliasing();
$graph->SetMarginColor('gray');
//$graph->SetShadow();
// Setup margin and titles
$graph->title->Set("Candidatos y Votos");
$p1 = new PiePlot3D($data);
$p1->SetSize(0.45);
$p1->SetCenter(0.4);
// Setup slice labels and move them into the plot
$p1->value->SetFont(FF_FONT1,FS_BOLD);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.5);
$p1->SetLegends($can);
$p1->ExplodeAll();
$graph->Add($p1);
$graph->Stroke();
?>
Saludos