Foros del Web » Programando para Internet » PHP »

generar grafico con fpdf

Estas en el tema de generar grafico con fpdf en el foro de PHP en Foros del Web. HOLA SOY DANIELA TENGO 24 AÑOS , ESTOY TRABAJANDO CON PHP , ESTOY GENERANDO UN ARCHIVO PDF EN DONDE ME APARECE UNA TABLA Y EN ...
  #1 (permalink)  
Antiguo 04/12/2006, 10:41
 
Fecha de Ingreso: diciembre-2006
Mensajes: 4
Antigüedad: 17 años, 5 meses
Puntos: 0
generar grafico con fpdf

HOLA SOY DANIELA TENGO 24 AÑOS , ESTOY TRABAJANDO CON PHP , ESTOY GENERANDO UN ARCHIVO PDF EN DONDE ME APARECE UNA TABLA Y EN LA SEGUNDA HOJA ME DEBERIA APARECER UN GRAFICO PERO NO ME SALE NO SE Q HACER , ME URGE

//ONTENER EL "HORARIO" PARA EL INFORME A GENERAR
$horario= $_POST['horario'];

/***********REALIZANDO CONSULTA PARA OBTENER LA INFORMACION PARA EL INFORME*****/
$result = mysql_query("SELECT * FROM alumnos WHERE tipo_horario='$horario' ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");


/********************** CREANDO EL INFORME ****************************/
$pdf=new PDF();
$pdf->AddPage();
$pdf->SetMargins(30,40);
//Arial bold 15
$pdf->SetFont('Arial','B',18);
//Movernos a la derecha
$pdf->Cell(80);
//Título
$pdf->Cell(30,10,'Alumnos Por Horario',0,0,'C');
$pdf->Ln(10);
$pdf->Cell(60);
$pdf->Cell(30,10,"Horario: $horario:00 horas",0,0,'C');
$pdf->Ln(30);
$pdf->SetFont('Arial','',12);

$html='<table border="1">
<tr><b>
<td width="50" height="30" ALIGN="" BGCOLOR=" ">Nº</td>
<td width="300" height="30" ALIGN="" BGCOLOR=" ">NOMBRE</td>
<td width="150" height="30" ALIGN="" BGCOLOR=" ">GRADO</td>
<td width="150" height="30" ALIGN="" BGCOLOR=" ">TELEFONO</td>
</b></tr>
</table>';
$pdf->WriteHTML($html);

$i=1;
while ($row = mysql_fetch_array($result)){
if($row['tipo_horario']==$horario){
$html="<table border='1'>
<tr>
<td width='50' height='30' ALIGN='C' BGCOLOR=''>$i</td>
<td width='300' height='30' ALIGN='C' BGCOLOR=''>$row[nombres] $row[apellido_paterno] $row[apellido_materno]</td>
<td width='150' height='30' ALIGN='C' BGCOLOR=''>$row[nombre_grado]</td>
<td width='150' height='30' ALIGN='C' BGCOLOR=''>$row[telefono]</td>
</tr>
</table>";
$pdf->WriteHTML($html);
$i++;
}
}
$pdf->AddPage();
$pdf->Output();
/********************* FIN INFORME *********************/

/*********************CREANDO GRAFICO*******************/
$pdf = new PDF_Diag();
$pdf->Open();
$pdf->AddPage();

/***************REALIZAR CONSULTA QUE CUENTE CUANTOS ALUMNOS POR TIPO DE PUBLICIDAD EXISTEN*********/
$horario_18 = mysql_query("SELECT count(tipo_horario) AS contador FROM alumnos WHERE tipo_horario='18' ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
$result_18 = mysql_fetch_array($horario_18);

$horario_19 = mysql_query("SELECT count(tipo_horario) AS contador FROM alumnos WHERE tipo_horario='19' ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
$result_19 = mysql_fetch_array($horario_19);

$horario_20 = mysql_query("SELECT count(tipo_horario) AS contador FROM alumnos WHERE tipo_horario='20' ",$conexion)
or die("La consulta contiene algún error:<br>nSQL: <b></b>");
$result_20 = mysql_fetch_array($horario_20);
/*********************ALMACENAR LOS VALORES DE LAS CONSULTAS EN UN ARREGLO***************/

$data = array('18 horas' => $result_18['contador'], '19 horas' => $result_19['contador'],'20 horas' => $result_20['contador']);


/*************grafico de barras****************/

$pdf->SetFont('Arial', 'B', 12);
$pdf->Cell(0, 90, ' ALUMNOS POR HORARIO', 0, 1,'C');
$pdf->Ln(8);
$valX = $pdf->GetX();
$valY = $pdf->GetY();
$pdf->BarDiagram(190, 70, $data, '%l : %v (%p)', array(100,175,100));
$pdf->SetXY($valX, $valY + 80);

//$pdf->Output();

BUENO AGRADECERIA Q ME AYUDARAN PLEASE
  #2 (permalink)  
Antiguo 04/12/2006, 10:46
Avatar de JavierB
Colaborador
 
Fecha de Ingreso: febrero-2002
Ubicación: Madrid
Mensajes: 25.052
Antigüedad: 22 años, 2 meses
Puntos: 772
Hola ubebita24. Bienvenido al foro.

El foro de Bienvenida a Foros del Web es para presentarse y, si quieres, contarnos algo sobre tí. Para preguntas concretas utiliza el foro que mejor se adapte a tu duda.

Muevo tu mensaje al foro de PHP desde Bienvenida a Foros del Web.

Saludos,
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 01:30.