Ver Mensaje Individual
  #2 (permalink)  
Antiguo 23/04/2013, 10:39
Avatar de anacona16
anacona16
 
Fecha de Ingreso: marzo-2010
Ubicación: Bogota DC
Mensajes: 610
Antigüedad: 14 años, 2 meses
Puntos: 52
Respuesta: Graficas con fpdf y jpgraph

Hola, he tenido la misma necesidad y la he resuelto de la siguiente manera, creas el PDF de manera normal con FPDF, luego (para mostrarte rapidamente) creas la grafica en el mismo archivo (no es lo mas optimo) de la siguiente manera:

Código PHP:
Ver original
  1. // Create the graph. These two calls are always required
  2.   $graph = new Graph(270, 200, 'auto');
  3.   $graph->SetScale("textlin");
  4.  
  5.   $theme_class = new UniversalTheme;
  6.   $graph->SetTheme($theme_class);
  7.  
  8.   $graph->SetBox(false);
  9.  
  10.   $graph->ygrid->SetFill(false);
  11.   $graph->xaxis->SetTickLabels(array('PA-01', 'PA-02', 'PA-03', 'PA-04'));
  12.   $graph->yaxis->HideLine(false);
  13.   $graph->yaxis->HideTicks(false, false);
  14.  
  15.   // Create the bar plots
  16.   $b1plot = new BarPlot($data1y);
  17.  
  18.   // Create the grouped bar plot
  19.   $gbplot = new GroupBarPlot(array($b1plot));
  20.   // ...and add it to the graPH
  21.   $graph->Add($gbplot);
  22.  
  23.   $b1plot->SetColor('white');
  24.   $b1plot->SetFillColor('#C5C5C5');
  25.  
  26.   $graph->title->Set("Promedios por Periodo:");
  27.  
  28.   $nombreImagen = 'path-absouta/uploads/info/' . uniqid() . '.png';
  29.  
  30.   // Display the graph
  31.   $graph->Stroke($nombreImagen);
  32.  
  33.   //Aqui agrego la imagen que acabo de crear con jpgraph
  34.   $pdf->Image($nombreImagen, $pdf->GetX() + 140, $pdf->GetY() - 25, 40, 30);

Luego puedes borrar la imagen con
Código PHP:
Ver original 
__________________
Aprendiendo!!!