Ver Mensaje Individual
  #1 (permalink)  
Antiguo 16/01/2013, 15:50
ShaoranTK
 
Fecha de Ingreso: mayo-2011
Mensajes: 125
Antigüedad: 13 años
Puntos: 3
Pregunta Reportes con jpgraph

Hola estoy aprendiendo hacer reportes con gráficos con la Liberia jpgraph, ya hice un reporte con barras dobles, pero el lado derecho de la imagen generada sale un poquito cortad, por ejemplo el 100 sale 10, todo número que pase de 2 dígitos los corta.

Acá la imagen para que me entiendan:



Y acá el código:

Código PHP:
Ver original
  1. <?php // content="text/plain; charset=utf-8"
  2. require_once ('src/jpgraph.php');
  3. require_once ('src/jpgraph_bar.php');
  4.  
  5. $datay=array(20,30,50,80);
  6. $datay2=array(10,20,40,70);
  7. $datazero=array(00,00,00,00);
  8.  
  9. // Create the graph.
  10. $graph = new Graph(400,400);
  11. $graph->title->Set('Ejemplo');
  12.  
  13. // Setup Y and Y2 scales with some "grace"
  14. $graph->SetScale("textlin");
  15. $graph->SetY2Scale("lin");
  16. $graph->yaxis->scale->SetGrace(10);
  17. $graph->y2axis->scale->SetGrace(10);
  18. // Setup graph colors
  19. $graph->yaxis->SetColor('#61A9F3');
  20. $graph->y2axis->SetColor('#76CE73');
  21.  
  22.  
  23. // Create the "dummy" 0 bplot
  24. $bplotzero = new BarPlot($datazero);
  25.  
  26. // Create the "Y" axis group
  27. $ybplot1 = new BarPlot($datay);
  28. $ybplot1->value->Show();
  29. $ybplot = new GroupBarPlot(array($ybplot1,$bplotzero));
  30. $ybplot1->SetLegend("Propietarios");
  31.  
  32. // Create the "Y2" axis group
  33. $ybplot2 = new BarPlot($datay2);
  34. $ybplot2->value->Show();
  35. $ybplot2->SetLegend("Presidentes");
  36. $y2bplot = new GroupBarPlot(array($bplotzero,$ybplot2));
  37.  
  38. // Add the grouped bar plots to the graph
  39. $graph->Add($ybplot);
  40. $graph->AddY2($y2bplot);
  41.  
  42. // .. and finally stroke the image back to browser
  43. $graph->Stroke(); ?>

Última edición por ShaoranTK; 16/01/2013 a las 15:56