Ver Mensaje Individual
  #8 (permalink)  
Antiguo 24/10/2006, 15:26
necu
 
Fecha de Ingreso: abril-2003
Ubicación: 127.0.0.1
Mensajes: 359
Antigüedad: 21 años
Puntos: 0
Sonrisa

Hola Olaforhc
Espero que este ejemplo te sirva, yo trabajo asi de esa forma y mi torta sale a la perfección
Cualquier duda posteala y te ayudare, espero tu respuesta.

Código:
Lo importante guarda el archivo con el mismo nombre como lo declaras al final $graph->StrokeCSIM('torta.php'); 
Código PHP:
<?php
//include de archivos de jpgraph
include ("librerias/jpgraph.php");
include (
"librerias/jpgraph_pie.php");
include (
"librerias/jpgraph_pie3d.php");

//consultas para obtener valores    
    
$consulta0=mysql_query("select * from tabla'");
    
$tota0 =mysql_num_rows($consulta0);     
//-------------------------------------------------------------------------
    
$consulta1=mysql_query("select * from tabla'");
    
$total1 =mysql_num_rows($consulta1); 
//-------------------------------------------------------------------------    
    
$consulta2=mysql_query("select * from tabla'");
    
$total2 =mysql_num_rows($consulta2); 
//-------------------------------------------------------------------------    
    
$consulta3=mysql_query("select * from tabla'");
    
$total3 =mysql_num_rows($consulta3); 

}
// array final
$data= array($total0,$total1,$total2,$total3);

//leyendas de los pedasos de torta
$leg= array("Leyenda 1\n%.1f%%","Leyenda 1.1\n%.1f%%","   Leyenda 1.2\n   %.1f%%","Leyenda 1.3\n%.1f%%"); 
$leg2=array("Leyenda 2");
$leg3= array("Leyenda 1 -> ($tota0)","Leyenda 1.1  -> ($total)","Leyenda 1.2 -> ($tota2)","Leyenda 1.3 -> ($total3)");

        
        
$graph = new PieGraph(470,258,"auto"); 
        
$graph->SetShadow(); 
        
$graph->title->Set($titulo); 
        
$graph->title->SetFont(FF_ARIAL,FS_BOLD,11); 
        
$graph->title->SetColor("red");
        
$graph->title->SetMargin(5);
        
$graph->SetFrame(false);
            
        
//foto.jpg corresponde a un fondo persalizado que coloco en mis graficos
        
$graph->SetBackgroundImage('fondo.jpg',BGIMG_FILLFRAME);
        
        
$p1 = new PiePlot3D($data); 
        
$p1->SetSize(.3); 
        
$p1->SetCenter(0.50); 
        
$p1->SetStartAngle(10); 
        
$p1->SetAngle(70); 
        
        
$p1->SetLabels($leg); 
        
$p1->SetCSIMTargets($leg2,$leg3); 
        
$p1->value->SetColor("darkblue"); 
        
$p1->value->SetFont(FF_FONT1,FS_BOLD); 
        
$p1->SetLabelType(PIE_VALUE_PER); 
        
$a array_search(max($data),$data);
        
$p1->ExplodeSlice($a); 
        
        
$graph->Add($p1); 
        
$graph->StrokeCSIM('torta.php');

    
?>
__________________
Practicando se Aprede
:-) :-)

Última edición por necu; 24/10/2006 a las 15:28 Razón: Espero que te ayude este codigito