Ver Mensaje Individual
  #1 (permalink)  
Antiguo 20/12/2007, 09:04
Dianinha
 
Fecha de Ingreso: febrero-2006
Mensajes: 42
Antigüedad: 18 años, 9 meses
Puntos: 0
Graficas en PHP

Holas señores, tengo que hacer un programa con gráficas, estoy utilizando php, mysql en dreamweaver, vi un código de ejemplo ya me bajé la librería jpgraph, pero igual me está dando el error de que ha mandado texto antes de la imagen, cómo lo puedo solucionar.

Ya revisé y no tengo ningin espacio ningun texto antes de llaamr al codigo php que genera la gráfica, aqui se los dejo a ver que opinan

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>Documento sin t&iacute;tulo</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?php include("jpgraph-1.22/src/jpgraph.php");
include("jpgraph-1.22/src/jpgraph_pie.php");
include("jpgraph-1.22/src/jpgraph_pie3d.php");
$data=array(40,60,21,33);
$graph=new PieGraph(450,200,"auto");
$graph->img->SetAntiAliasing();
$graph->SetMarginColor('gray');
//$graph->SetShadow();
// Setup margin and titles
$graph->title->Set("Ejemplo: Horas de Trabajo");
$p1=new PiePlot3D($data);
$p1->SetSize(0.35);
$p1->SetCenter(0.5);
// Setup slice labels and move them into the plot
$p1->value->SetFont(FF_FONT1,FS_BOLD);
$p1->value->SetColor("black");
$p1->SetLabelPos(0.2);
$nombres=array("pepe","luis","miguel","alberto");
$p1->SetLegends($nombres);
// Explode all slices
$p1->ExplodeAll();
$graph->Add($p1);
$graph->Stroke();
?>
</head>
<body>
</body>
</html>

EL error que me da es este:
JpGraph Error: HTTP headers have already been sent.
Caused by output from file grafico_linea.php at line 6.
Explanation:
HTTP headers have already been sent back to the browser indicating the data as text before the library got a chance to send it's image HTTP header to this browser. This makes it impossible for the library to send back image data to the browser (since that would be interpretated as text by the browser and show up as junk text).
Most likely you have some text in your script before the call to Graph::Stroke(). If this texts gets sent back to the browser the browser will assume that all data is plain text. Look for any text, even spaces and newlines, that might have been sent back to the browser.

For example it is a common mistake to leave a blank line before the opening "<?php".
__________________
Somos lo que nos proponemos...Cuenta con la ayuda de un ser supremo para lograrlo.