<?php
require_once('Connections/connAgenda.php');
include ("jp/jpgraph.php");
include ("jp/jpgraph_pie.php");
include ("jp/jpgraph_pie3d.php");
$colname_pfecha_ini = "-1";
$colname_pfecha_fin = "-1";
if (isset($_GET['p_fecha_ini'])) {
$colname_pfecha_ini = (get_magic_quotes_gpc()) ? $_GET['p_fecha_ini'] : addslashes($_GET['p_fecha_ini']);
}
if (isset($_GET['p_fecha_fin'])) {
$colname_pfecha_fin = (get_magic_quotes_gpc()) ? $_GET['p_fecha_fin'] : addslashes($_GET['p_fecha_fin']);
}
mysql_select_db($database_connAgenda, $connAgenda);
$query_rsTemas = "SELECT tema, count(*)
FROM webcal_entry we, webcal_tema wt, webcal_entry_user weu
WHERE we.cal_id_tema = wt.id_tema
and we.cal_id = weu.cal_id
and weu.cal_status != 'D'
and cal_date <= $colname_pfecha_fin
and cal_date >= $colname_pfecha_ini
GROUP BY 1";
$rsTemas = mysql_query($query_rsTemas, $connAgenda) or die(mysql_error());
$data=array();
$name=array();
$i=0;
while($row=mysql_fetch_array($rsTemas)){
$data[$i]=$row['count(*)'];
$name[$i]=$row['tema'];
$i++;
}
$colores=array('#FF9933','#FFCC00','#009999','#999966','#CC6633','#6666CC','#AACCCC','#CCCC33','#009966','#9966CC','#AA6633','#66CCCC');
//$data = array(10,20,30,40);
$graph = new PieGraph(450,200,"auto");
$graph->img->SetAntiAliasing();
$graph->SetMarginColor('#EEEEEE');
$graph->SetShadow();
// Setup margin and titles
$graph->title->Set("TEMA");
$graph->title->SetFont(FF_FONT1,FS_BOLD);
$graph->title->SetColor("darkblue");
$graph->legend->Pos(0.02,0.2);
$p1 = new PiePlot3D($data);
$p1->SetSize(0.35);
$p1->SetCenter(0.4);
// Setup slice labels and move them into the plot
$p1->value->SetFont(FF_FONT1,FS_NORMAL);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.2);
//$nombres=array("pepe","luis","miguel","alberto");
$p1->SetLegends($name);
// Explode all slices
$p1->ExplodeAll();
$graph->Add($p1);
$graph->Stroke();
$p1->SetTheme("sand");
$p1->SetCenter(0.35);
$p1->SetAngle(30);
$p1->value->SetFont(FF_ARIAL,FS_NORMAL);
$p1->SetSliceColors($colores);
$graph->Add($p1);
$graph->Stroke();
?>
<img src="generador_imagen.php?parametro1=enero¶metro2=febrero">