<?php
include('dbconn.php');
// Het bibliotheek bestand invoegen
require_once ('jpgraph/src/jpgraph.php');
require_once ('jpgraph/src/jpgraph_pie.php');
// A new pie graph
$graph = new PieGraph(400,150,"auto");
$graph->SetShadow();
//get data from database
$sql="SELECT afkomst, COUNT(*) AS 'count' FROM overzicht WHERE DATE(datum) = CURDATE() GROUP BY afkomst";
$result = mysql_query($sql) or die('Query failed: ' . mysql_error());
if ($result) {
while ($row = mysql_fetch_assoc($result)) {
$legends[] = $row["afkomst"];
$data[] = $row["count"];
}
}
// Setup the pie plot
$p1 = new PiePlot($data);
// Adjust size and position of plot
$p1->SetSize(0.4);
$p1->SetCenter(0.10,0.30);
// Setup slice labels and move them into the plot
$p1->value->SetFont(FF_ARIAL,FS_NORMAL,11);
$p1->value->SetColor("darkred");
$p1->SetLabelPos(0.65);
// Use absolute values (type==1)
$p1->SetLabelType(PIE_VALUE_ABS);
// Label format
$p1->value->SetFormat("%d");
$p1->value->HideZero();
$p1->value->Show();
// Set legends
$p1->SetLegends($legends);
$graph->legend->Pos(-0.00,0.05);
$graph->legend->SetLayout(LEGEND_VERT);
// Explode all slices
$p1->ExplodeAll(8);
// Add drop shadow
$p1->SetShadow();
// Finally add the plot
$graph->Add($p1);
// ... and stroke it
$graph->Stroke();
?><?php
require_once ('jpgraph/src/jpgraph.php');
require_once ('jpgraph/src/jpgraph_pie.php');
$graph = new PieGraph(400,150,"auto");
$graph->SetShadow();
$data = array(45, 23, 18, 32);
$pieplot = new PiePlot($data);
$pieplot->SetSize(0.35);
$pieplot->SetCenter(0.10,0.10);
$graph->Add($pieplot);
$graph->Stroke();
?><?php
require_once ('jpgraph/src/jpgraph.php');
require_once ('jpgraph/src/jpgraph_pie.php');
$graph = new PieGraph(400,150,"auto");
$graph->SetShadow();
$data = array(45, 23, 18, 32);
$pieplot = new PiePlot($data);
$pieplot->SetSize(0.35);
$pieplot->SetCenter(0.3,0.5);
$graph->Add($pieplot);
$graph->Stroke();
?>