Ver Mensaje Individual
  #1 (permalink)  
Antiguo 27/02/2011, 05:48
peligro13
 
Fecha de Ingreso: febrero-2011
Mensajes: 2
Antigüedad: 13 años, 2 meses
Puntos: 0
error en jpgraph

Me sale el siguiente error en jpgraph:


"JpGraph Error: HTTP headers have already been sent.
Caused by output from file clagunas.php at line 12.
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"."



Este es mi codigo

<?php
include ('Clases.php');
$conexion = conectar();
$fecha = $_POST['txtFecha'];
$formateo = str_replace('/','-',$fecha);
$fecha = date('Y-m-d', strtotime($fecha));
$fecha2 = $_POST['txtFecha2'];
$formateo = str_replace('/','-',$fecha2);
$fecha2 = date('Y-m-d', strtotime($fecha2));
$sql=mysql_query("SELECT * FROM generales where fecha_gen between '$fecha' and '$fecha2' ORDER BY fecha_gen Asc");
$ydata = array();
while($bus = mysql_fetch_array($sql)){
array_push($ydata,$bus[valor_gen]);
}
$sql2=mysql_query("SELECT * FROM generales2 where fecha_gendos between '$fecha' and '$fecha2'ORDER BY fecha_gendos Asc");
$ydata2 = array();
while($bus = mysql_fetch_array($sql2)){
array_push($ydata2,$bus[valor_gendos]);
}
$sql3=mysql_query("SELECT * FROM generales where fecha_gen between '$fecha' and '$fecha2'ORDER BY fecha_gen Asc");
$xdata = array();
while($bus = mysql_fetch_array($sql3)){
array_push($xdata,$bus[fecha_gen]);
}
include("jpgraph.php");
include("jpgraph_line.php");
$graph = new Graph(1000,450,"auto");
$graph->SetScale("textlin");
$graph->title->Set('Piso de Ruido generales');
$graph->xaxis->title->Set('Fecha');
$graph->yaxis->title->Set('Nivel en dB');
$graph->ygrid->SetFill(true,'#[email protected]','#[email protected]');
$graph->xaxis->SetTickLabels($xdata);
$graph->xaxis->SetLabelAngle(90);
$lineplot = new LinePlot($ydata);
$lineplot->SetColor("red");
$lineplot->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot->mark->SetFillColor("red");
$lineplot->mark->SetWidth(2);
$lineplot->SetLegend("Piso de Ruido");
$lineplot2 = new LinePlot($ydata2);
$lineplot2->SetColor("green");
$lineplot2->mark->SetType(MARK_FILLEDCIRCLE);
$lineplot2->mark->SetFillColor("green");
$lineplot2->mark->SetWidth(2);
$lineplot2->SetLegend("Diferencia");
$graph->Add($lineplot);
$graph->Add($lineplot2);
$graph->Stroke();
mysql_close($conexion);
?>


Gracias