Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/04/2014, 12:14
Avatar de extramex
extramex
 
Fecha de Ingreso: marzo-2014
Ubicación: Torreon
Mensajes: 9
Antigüedad: 10 años, 1 mes
Puntos: 0
Exclamación JPGraph muestra imagen rota.

Hola!

Antes que nada les agradeceria leer todo el post antes de contestar, mi problema es el siguiente.

Estoy elaborando una grafica multi linea con JPGraph y al momento de enviar la información lo unico que me muestra es una imagen rota.

Ya cheque la libreria GD y si esta activada en mi php.ini.

Mi codigo para crear la Libreria es el siguiente, las variables las recojo de un form el cual lee correctamente todos los datos, el problema viene al momento de crear la grafica

Código PHP:
<?php 
if(isset($_POST['enviar']))
{
header("content-type: image/png");
include (
"jpgraph/jpgraph.php");
include (
"jpgraph/jpgraph_line.php");
$fechauno $_POST['fecha1'];
$fechados $_POST['fecha2'];
$sucursal $_POST['nombresuc'];
$datax = array();
$datay1 = array();
$datay2 = array();
$datay3 = array();
$datay4 = array();
$i 0$j 0;
$query "SELECT * from reporteventas WHERE nombresuc='".$sucursal."' AND fecha BETWEEN '".$fechauno."' AND '".$fechados."'";
$result mysql_query($query);
  
$numero 0;
  while(
$row mysql_fetch_array($result))
  {
             
$datax[]=$row["fecha"];
            
$datay1[]=$row["rentas"];
            
$datay2[]=$row["inscripcion"];
            
$datay3[]=$row["retardos"];
            
$datay4[]=$row["dulces"];
 
  }
    
mysql_free_result($result);
// Setup the graph
$graph = new Graph(500,400);
$graph->SetScale('intlin');

$theme_class=new UniversalTheme;

$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Space Video');
$graph->img->SetMargin(70,15,30,60); // Sets the margin.  L, R, T, B
$graph->SetBox(false);

$graph->SetYScale(0,'lin');
$graph->SetYScale(1,'lin');
$graph->SetYScale(2,'lin');
$graph->img->SetAntiAliasing();

$p1 = new LinePlot($datay1);
$graph->Add($p1);

$p2 = new LinePlot($datay2);
$p2->SetColor('teal');
$graph->AddY(0,$p2);
$graph->ynaxis[0]->SetColor('teal');

$p3 = new LinePlot($datay3);
$p3->SetColor('red');
$graph->AddY(1,$p3);
$graph->ynaxis[1]->SetColor('red');

$p4 = new LinePlot($datay4);
$p4->SetColor('blue');
$graph->AddY(2,$p4);
$graph->ynaxis[2]->SetColor('blue');

$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
$graph->yaxis->title->Set('Player Logs');
$graph->yaxis->SetTitleMargin(50);

$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels($datay);
$graph->xaxis->SetLabelAngle(60);
$graph->xgrid->SetColor('#E3E3E3');

// Create the first line
$p1 = new LinePlot($datax);
$graph->Add($p1);
$p1->mark->SetType(MARK_FILLEDCIRCLE,'',1.0);
$p1->mark->SetColor('#6495ED');
$p1->SetColor("#6495ED");
$p1->SetLegend('legend');

/* Create the second line
$p2 = new LinePlot($datay2);
$graph->Add($p2);
$p2->SetColor("#B22222");
$p2->SetLegend('Line 2');

// Create the third line
$p3 = new LinePlot($datay3);
$graph->Add($p3);
$p3->SetColor("#FF1493");
$p3->SetLegend('Line 3');
*/

// Output line

$grafico->Stroke(_IMG_HANDLER);

$fileName "grafica1.png";
$grafico->img->Stream($fileName);

// mostrarlo en el navegador
$grafico->img->Headers();
$grafico->img->Stream();


}
?>
Espero posibles soluciones