problème d'affichage d'un graphique en php sur ma page html
Bonjour,
je souhaite afficher un graphique en bâton(codé en php)sur une page html mais ça ne marche pas.
En fait j'ai une page php poour la création du graphique et une page html pour afficher le graphique.
voici ci-dessous mes fichiers
graphique.php
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
| <?php
require_once('Artichow/BarPlot.class.php');
//Connexion au serveur MySQL
$db=mysql_connect("localhost","v_util","vpc@2006") or die ("erreur de connexion".mysql_error());
//ouverture de la base bac
mysql_select_db("bac",$db)or die("erreur de connexion à la base ");
//tableau de resultat
$annee = array();
$pourcentage = array();
$sql = "SELECT annee, pourcentage FROM resultat" or die('req invalide');
$req = mysql_query($sql);
while($result = mysql_fetch_array($req)){
array_push($pourcentage, $result[0]);
array_push($annee, $result[1]);
}
//creation du graphique : batons
$graph = new Graph(500,500);
$graph->setAntiAliasing(TRUE);
//Creation du LinePlot
$plot = new BarPlot($annee);
//ajoute une couleur de fond aux barres
$plot->setBarColor(
new Color(255, 250, 250)
);
//On un ajoute un titre
$plot->title->set("Résultats du BAC STG GSI");
$plot->title->setFont(new TuffyBold(11));
$plot->title->border->show();
$plot->title->setBackgroundColor(new Color(255, 255, 255, 25));
$plot->title->setPadding(4, 4, 4, 4);
$plot->title->move(-20, 25);
// Ajout du titre de l'axe des Y
$plot->yAxis->title->set("Pourcentage");
$plot->yAxis->title->setFont(new TuffyBold(10));
$plot->yAxis->title->move(-4, 0);
$plot->yAxis->setTitleAlignment(Label::TOP);
//Ajout du titre de l'axe des X
$plot->xAxis->title->set("Année");
$plot->xAxis->title->setFont(new TuffyBold(10));
$plot->xAxis->setTitleAlignment(Label::RIGHT);
// On ajoute 5 % d'espace à gauche et à droite de l'histogramme.
// On ne change pas l'espace du haut et du bas de l'histogramme.
$plot->setSpace(
5, /* Gauche */
5, /* Droite */
NULL, /* Haut */
NULL /* Bas */
);
// On choisit une ombre de 3 pixels
$plot->barShadow->setSize(3);
// On place l'ombre sur les côtés haut et droit.
// Si vous utilisez Artichow pour PHP 4 & 5, transformez Shadow::RIGHT_TOP en SHADOW_RIGHT_TOP
$plot->barShadow->setPosition(Shadow::RIGHT_TOP);
// On veut une ombre de couleur grise
$plot->barShadow->setColor(new Color(256, 180, 180, 10));
// On choisit de lisser les extrémités de l'ombre
$plot->barShadow->smooth(TRUE);
//Affichage des noms sur l'axe X
$plot->xAxis->setLabelText($pourcentage);
//Affichage du graphe
$graph->add($plot);
$graph->draw();
// fermer la connexion à la base
mysql_close($db);
?> |
Résultat.html
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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
| <html>
<head>
<title>
Lycee Daniel Dumand
</title>
</head>
<link rel="stylesheet" type="text/css" href="AC.css" />
<body>
<div id="lien">
<table>
<tr>
<td><a href="Acceuil.html"> Accueil </a></td>
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>|
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>
<td><a href="metier.html"> Metiers </a></td>
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>|
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>
<td><a href="deboucher.html"> Debouchés </a></td>
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>|
<td><td><td><td><td><td><td><td><td><td><td><td><td><td><td>
<td><a href="resultat.html"> Resultats </a></td>
</table>
</div>
<div id="centre">
<center><img src="rr.jpg"></center>
<center>
</br>
<p><h5><font color="#5a5a00"> Ces résultats montre le taux de reussite en pourcentage de la série STG GSI entre 2006 et 2010.</font></p></br></h5>
</center>
<center><img src="graphique.php"></center>
</div>
<center><h5><p>Source : Secretariat du lycée Daniel Dumand </p></h5></center>
<div id="img3">
<img src="hobbie-dessin.gif">
</div>
</body>
</html> |
Auriez vous une idée pourquoi ça ne marche pas?
Cordialement
problème d'affichage d'un graphique en php sur ma page html Répondre à la discussion
Bonjour,
Merci beaucoup de m'avoir répondu,
Voici l'erreur qu'on m'indique sur la page php concernant le graphique:
Citation:
Warning: require_once(Artichow/BarPlot.class.php) [function.require-once]: failed to open stream: No such file or directory in C:\Program Files\EasyPHP5.3.0\www\site\graphique.php on line 2
Fatal error: require_once() [function.require]: Failed opening required 'Artichow/BarPlot.class.php' (include_path='.;C:\php5\pear') in C:\Program Files\EasyPHP5.3.0\www\site\graphique.php on line 2
Auriez-vous une idée?
Très cordialement