Utilisation de JpGraph
Posté : 01 avr. 2008, 15:56
Je suis de retour (pour de plus belles aventures????? ...)
Alors mon petit tableau, je souhaite l'utiliser pour créer un graphique, avec JpGraph.
La variable $date est recupérée depuis un formulaire...
Voici mon code...
Mais seulement, lorsque je cherche a utiliser mon outil JpGraph, il me met une erreur qui est la suivante:
JpGraph Error: HTTP headers have already been sent.
Caused by output from file calendrier.php at line 4.
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"
J'ai cherché a droite a gauche, j'ai trouvé des petits trucs concernant une éventuelle ligne blanche en début de fichier, mais rien n'y fait...
...
POURQUOI TANT DE HAINE?????

Alors mon petit tableau, je souhaite l'utiliser pour créer un graphique, avec JpGraph.
La variable $date est recupérée depuis un formulaire...
Voici mon code...
<?php
include_once ('jpgraph/jpgraph.php');
include_once ('jpgraph/jpgraph_line.php');
include ('C_BDD.php');
include ('C_GSM.php');
include('C_FonctionsUtiles.php');
$mesure = 'Temperature';
$gsm = new C_GSM;
$bdd = new C_BDD;
$fu = new C_FonctionsUtiles;
$bdd->ConnectBdd("meteodeurs");
$date = $_GET['calendrierCourbe']; //Récuperation de la date depuis le formulaire
$dateBase = $fu->dateswitch($date); //CONVERSION de la date en format 'americain' pour utilisation dans la base
$tab = $bdd->GetMeteoDate($mesure,$dateBase); //Création de mon fameux petit tableau
$bdd->DeconnectBdd();
$graph = new Graph(600,200); //
//
$graph->SetScale('textlin'); //
//
$lineplot = new LinePlot($tab); // Utilisation de JpGraph
//
$graph->Add($lineplot); //
//
$graph->stroke(); //
?>
Tout fonctionne correctement jusqu'a la conversion de la date, la récupération se fait correctement (j'arrive a afficher les valeurs de mon tableau...)Mais seulement, lorsque je cherche a utiliser mon outil JpGraph, il me met une erreur qui est la suivante:
JpGraph Error: HTTP headers have already been sent.
Caused by output from file calendrier.php at line 4.
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"
J'ai cherché a droite a gauche, j'ai trouvé des petits trucs concernant une éventuelle ligne blanche en début de fichier, mais rien n'y fait...
...
POURQUOI TANT DE HAINE?????