Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/06/2013, 12:40
janyazul
 
Fecha de Ingreso: noviembre-2008
Mensajes: 14
Antigüedad: 15 años, 5 meses
Puntos: 0
Pregunta Como pongo leyendas en graficas de barras en Jpgraph?

Hola, Estoy haciendo unas graficas en Jpgraph, pero necesito que aparezcan los valores de X en una cuadro leyenda.

Este es mi codigo:
include("../sesion.php");
include("../bd.php");
include("../src/jpgraph.php");
include("../src/jpgraph_bar.php");
$result = mysql_query("SELECT * FROM tabla", $bd);
$fecha = strftime("%d de $mes del %Y");

$A=0;
$B=0;
$C=0;

while($row= mysql_fetch_array($result))
{
if($row['A2']=="1")
{
$B++;
}
if($row['A2']=="2")
{
$C++;
}
if($row['A2']==0)
{
$A++;
}
}

$total2=$A+$B+$C;
$a=array(Femenino,Masculino,'No se registro');
$ydata = array($B,$C,$A);
$maximo=max(array_values($ydata));
$total3=$maximo;
$graph = new Graph(1024,600, "auto");
$graph->SetScale("textlin",0,$total3);

$graph->img->SetMargin(70, 50, 60, 130);
$graph->SetBackgroundGradient($aFrom='white',$aTo='dodger blue3',$aGradType=2,$aStyle=BGRAD_MARGIN);
$graph->title->Set("Sexo\n");
$graph->title->SetFont(FF_ARIAL,FS_NORMAL,20, "center", "center");
$graph->xaxis->title->Set("Total $total2 registros\n$fecha");
$graph->title->SetMargin(25);
$graph->xaxis->SetTitlemargin(80);
$graph->yaxis->title->Set("Total" );
$graph->yaxis->SetTitlemargin(50);
// Setup font for axis
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,10);
$graph->yaxis->SetFont(FF_ARIAL,FS_NORMAL,10);

// Show 0 label on Y-axis (default is not to show)
$graph->yscale->ticks->SupressZeroLabel(false);
$graph->xaxis->SetTickLabels($a);
$graph->xaxis->SetLabelAngle(50);
$barplot =new BarPlot($ydata);
$barplot->SetColor("orange");
$barplot->SetFillColor('dodgerblue4');
$barplot->value->Show();

$graph->Add($barplot);
$graph->Stroke();


Y asi es como queda la grafica:



Lo que quiero es que me aparezca, Femenino, Masculino y No se registro, en una leyenda (un recuadro aparte del lado derecho).

De antemano muchas gracias y espero me puedan ayudar