Warning: Invalid argument supplied for foreach() in C:\AppServ\www\pChart\pChart.class on line 3338
Warning: max() [function.max]: Array must contain at least one element in C:\AppServ\www\pChart\pChart.class on line 3349
Warning: Invalid argument supplied for foreach() in C:\AppServ\www\pChart\pChart.class on line 2650
[FATAL] Pie chart can only accept one serie of data.
el codigo es el siguiente, agradeceria que algiuien me lo revisara y me dijera que estoy haciendo mal en la consulta.
Código PHP:
<?php
include "conexxion.php";
require_once("fondo.html");
$cn=LibMySQL::getInstancia();
include("pChart/pData.class");
include("pChart/pChart.class");
$busqueda = $_POST['fecha1'];
$busquedaa = $_POST['fecha2'];
$rs=$cn->consultar("SELECT COUNT(*) as cedad,edad FROM usuario_principal GROUP BY edad asc WHERE fecha BETWEEN '$fecha1' AND '$fecha2' ;");
$edad=array();
$cedad=array();
foreach($rs as $datos){
$edad[]=$datos['edad']." años";
$cedad[]=$datos['cedad'];
}
$DataSet = new pData;
$DataSet->AddPoint($edad,"Edad");
$DataSet->AddPoint($cedad,"Porcentajes");
$DataSet->AddAllSeries();
$DataSet->SetAbsciseLabelSerie("Edad");
$Test = new pChart(380,200);
$Test->drawFilledRoundedRectangle(7,7,373,193,5,240,240,240);
$Test->drawRoundedRectangle(5,5,375,195,5,230,230,230);
$Test->setGraphArea(50,30,585,200);
$Test->setFontProperties("Fonts/tahoma.ttf",10);
$Test->drawTitle(10,20,"EDADES",100,100,100);
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->drawPieGraph($DataSet->GetData(),$DataSet->GetDataDescription(),150,90,110,PIE_PERCENTAGE,TRUE,50,20,5);
$Test->drawPieLegend(310,15,$DataSet->GetData(),$DataSet->GetDataDescription(),250,250,250);
$Test->Render("Reporteedad.png");
?>