PHP - Error al mostrar Grafico con JPGRAPH

 
Vista:
sin imagen de perfil

Error al mostrar Grafico con JPGRAPH

Publicado por Patricio (16 intervenciones) el 03/08/2014 21:30:33
Estimado

estoy tratando de mostrar graficos estadisticos en un pagina web para lo cual instale jpgraph en la raiz del directorio.
pero al ver la pagina me sale el siguiemte error.

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

tengo duda si sera problema de la ubicacion de la carpeta, la cual la tengo asi:

require_once ('jpgraph/src/jpgraph.php');
require_once ('jpgraph/src/jpgraph_bar.php');

agregue la ubicacion src para seguir el archivo.

no se cual pueda ser el error.

agradeciendo la ayuda

atte.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Error al mostrar Grafico con JPGRAPH

Publicado por xve (6935 intervenciones) el 04/08/2014 10:20:42
Hola Patricio, lo que te esta comentando, es que has enviado algo al navegador, ya sea un echo "..." o código html.

en la pagina que generas las gráfica, no puede haber código html.

Coméntanos si es este el problema, ok?
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
sin imagen de perfil

Error al mostrar Grafico con JPGRAPH

Publicado por Patricio (16 intervenciones) el 04/08/2014 17:52:42
ESTIMADO

ESTE ES EL CODIGO QUE TENGO, LO HE PROBADO DE VARIAS FORMAS Y NO HAY CASO, ENTREGA EL MISMO ERROR DE ARRIBA O A VECES TAMBIEN MUESTRA UN MARCADOR DE IMAGEN VACIO.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?
require_once ('jpgraph/src/Examples/jpgraph/jpgraph.php');
require_once ('jpgraph/src/Examples/jpgraph/jpgraph_bar.php');
require_once('Connections/conexion.php');
 
mysql_select_db($database_conexion, $conexion);
 
$query = mysql_query ("SELECT fecha, SUM(valor) FROM examenes WHERE fecha BETWEEN '2014-07-21' AND '2014-07-25' GROUP BY fecha",$conexion);
 
while($fila = mysql_fetch_row($query))
 
    {
     $valor= $fila[1];
    }
 
$graph = new Graph(350, 250, "auto");
$graph->SetScale("textlin");
 
$graph->img->SetMargin(40, 20, 20, 40);
$graph->title->Set("VENTA DIARIA");
$graph->xaxis->title->Set("DIAS" );
$graph->yaxis->title->Set("TOTAL" );
 
$barplot =new BarPlot($valor);
$barplot->SetColor("orange");
 
$graph->Add($barplot);
$graph->Stroke();
 
mysql_free_result($query);
?>

DE ANTEMANO GRACIAS

ATTE.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar
Imágen de perfil de xve
Val: 3.943
Oro
Ha mantenido su posición en PHP (en relación al último mes)
Gráfica de PHP

Error al mostrar Grafico con JPGRAPH

Publicado por xve (6935 intervenciones) el 04/08/2014 23:43:24
Hola Patricio, parece que todo esta bien... yo probaría a ejecutar el archivo directamente en el navegador sin las lineas:

1
2
$graph->Add($barplot);
$graph->Stroke();

haber si te muestra algún error en pantalla.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar