Cordial Saludo,
He usado por primera vez la libreria jpgraph, todo me ha salido muy bien, a exepcion de la posicion de una leyenda Y ya que me sale muy pegada a los datos de la grafica y quyeda montado los numeros de la grafica y la leyenda por lo que no se entiende los datos.... . ¿ como puedo correr la leyenda un poco mas a la izquierda?
Codigo:
Código PHP:
Ver original<?php
include ("conexion.php");
require_once ('../jpgraph/src/jpgraph.php');
require_once ('../jpgraph/src/jpgraph_bar.php');
// $Id: barscalecallbackex1.php,v 1.2 2002/07/11 23:27:28 aditus Exp $
$ano=$_GET['ano'];
$mes=$_GET['mes'];
$mesi=$mes;
//$ano=2012;
SELECT day(HoraTiquete),count(IdPeticion)
FROM tblpeticiones
WHERE year(HoraTiquete)=$ano && month(HoraTiquete)=$mes
GROUP BY 1
");
{
}
$sql=mysql_query("SELECT day(HoraTiquete),count(IdPeticion) FROM tblpeticiones
WHERE year(HoraTiquete)=$ano && month(HoraTiquete)=$mes
GROUP BY 1
");
{
}
// Callback function for Y-scale
function yScaleCallback($aVal) {
}
// Some data
//$datay=array(120567,134013,192000,87000);
// Create the graph and setup the basic parameters
$graph = new Graph(460,200,'auto');
$graph->img->SetMargin(80,30,30,40);
$graph->SetScale("textint");
$graph->SetShadow();
$graph->SetFrame(false); // No border around the graph
// Add some grace to the top so that the scale doesn't
// end exactly at the max value.
// Since we are using integer scale the gace gets intervalled
// to adding integer values.
// For example grace 10 to 100 will add 1 to max, 101-200 adds 2
// and so on...
$graph->yaxis->scale->SetGrace(30);
$graph->yaxis->SetLabelFormatCallback('yScaleCallback');
$graph->yaxis->SetTitle("Fichos Atendidas","middle");
// Setup X-axis labels
//$a = $gDateLocale->GetShortMonth();
$graph->xaxis->SetTickLabels($mes);
$graph->xaxis->SetFont(FF_FONT1);
$graph->xaxis->SetTitle("Dias de atencion","middle");
// Setup graph title ands fonts
$graph->title->Set("Operaciones acumuladas por dia durante el $ano y mes $mesi ");
$graph->title->SetFont(FF_FONT1);
//$graph->xaxis->title->Set("Year 2002");
$graph->xaxis->title->SetFont(FF_FONT1);
// Create a bar pot
$bplot = new BarPlot($datay);
//$bplot->SetFillColor("blue");
$bplot->SetWidth(0.5);
$bplot->SetShadow();
// Setup the values that are displayed on top of each bar
$bplot->value->Show();
// Must use TTF fonts if we want text at an arbitrary angle
$bplot->value->SetFont(FF_FONT1);
$bplot->value->SetAngle(90);
$bplot->value->SetFormat(' %0.0f');
// Black color for positive values and darkred for negative values
$bplot->value->SetColor("black","darkred");
$graph->Add($bplot);
// Finally stroke the graph
$graph->Stroke();
?>