[JpGraph] Probleme Programmation Objet et Jpgraph
Bonjour, j'ai un petit problème avec JPGraphe, je cherche a afficher un graphe via une classe mais sans réussite jusqu'ici.
Voila mon code:
Tout d'abord mon fichier test.php dans lequel j'ai créer un classe bidon.
Code:
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
| <?php
class test
{
public function afficherGraphe($tab)
{
include ("jpgraph/src/jpgraph.php");
include ("jpgraph/src/jpgraph_line.php");
//$ydata = array(8,3,16,2,7,-25,16);
// Creation du graphique
$graph = new Graph(300,200);
$graph->SetScale("textlin");
// Création du système de points
$lineplot=new LinePlot($tab);
// On rajoute les points au graphique
$graph->Add($lineplot);
// Affichage
$graph->Stroke();
}
}
?> |
Puis mon fichier index.php
Code:
1 2 3 4 5 6 7 8 9 10
| <?php
include ("test.php");
$xxx = array(5, 55, -8, 52, 21);
$objet=new test();
$objet->afficherGraphe($xxx);
?> |
A l'affichage de index.php, j'obtiens le message suivant:
"L'image Http......... ne peut être affiché car elle contient des erreurs"
Je débute avec cette librairie donc épargnez moi^^