Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Images > Artichow
Artichow Forum d'entraide pour la bibliothèque Artichow permettant de manipuler des images en PHP.
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 03/12/2010, 16h54   #1
Candidat au titre de Membre du Club
 
Inscription : juin 2010
Messages : 102
Détails du profil
Informations personnelles :
Âge : 22

Informations forums :
Inscription : juin 2010
Messages : 102
Points : 13
Points : 13
Par défaut Créer une courbe avec les données d'une base de données

Bonjour,

J'ai suivi tous les tutoriel du site d'Artichow mais ça ne marche pas chez moi... Je suis dans le cas d'un histogramme simple.

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
 
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="fr">
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
  <title>Historigramme des AssMat</title>
 
  <link rel="stylesheet" media="screen" href="style.css">
 
  <script type="text/javascript" src="script.js"></script>
</head>
<body>
Historigramme des cinqs dernière mise à jour Assmat
<hr>
<?php
mysql_connect("*****","*****","*****") ;
mysql_select_db("*****") ;
mysql_query("SET NAMES 'utf8'");
 
$requete = mysql_query("select * from date order by id_date limit 0,4");
 
while ( $ligne = mysql_fetch_row($requete) ){
    $ecart = $ligne[3] ;
 
    echo"Une donnée : $ecart <br>";
}
 
 
   require_once "artichow/BarPlot.class.php";
 
   $graph = new Graph(400, 400);
   $graph->setAntiAliasing(TRUE);
 
   $values = array(19, 42, 15, -25, 3);
   $plot = new BarPlot($values);
   $plot->setBarColor(
      new Color(250, 230, 180)
   );
   $plot->setSpace(5, 5, NULL, NULL);
 
   $plot->barShadow->setSize(3);
   $plot->barShadow->setPosition(Shadow::RIGHT_TOP);
   $plot->barShadow->setColor(new Color(180, 180, 180, 10));
   $plot->barShadow->smooth(TRUE);
 
   $graph->add($plot);
   $graph->draw();
 
 
?>
</body>
</html>
tonymx15 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 04/12/2010, 23h33   #2
Modérateur
 
Avatar de mathieu
 
Inscription : juin 2003
Messages : 4 893
Détails du profil
Informations forums :
Inscription : juin 2003
Messages : 4 893
Points : 4 466
Points : 4 466
si je garde juste cette partie du code le graphique s'affiche bien donc le problème doit se trouver dans la partie de ton code qui récupère les données dans la base de données
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
   require_once "artichow/BarPlot.class.php";
 
   $graph = new Graph(400, 400);
   $graph->setAntiAliasing(TRUE);
 
   $values = array(19, 42, 15, -25, 3);
   $plot = new BarPlot($values);
   $plot->setBarColor(
      new Color(250, 230, 180)
   );
   $plot->setSpace(5, 5, NULL, NULL);
 
   $plot->barShadow->setSize(3);
   $plot->barShadow->setPosition(Shadow::RIGHT_TOP);
   $plot->barShadow->setColor(new Color(180, 180, 180, 10));
   $plot->barShadow->smooth(TRUE);
 
   $graph->add($plot);
   $graph->draw();
__________________
Modérateur PHP
mathieu est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/12/2010, 14h14   #3
Candidat au titre de Membre du Club
 
Inscription : juin 2010
Messages : 102
Détails du profil
Informations personnelles :
Âge : 22

Informations forums :
Inscription : juin 2010
Messages : 102
Points : 13
Points : 13
Non le graphique ne s'affiche pas ça m'affiche un texte avec des caractères spéciaux...

Et sinon, pour le moment je ne mets pas en compte les données de la base de donnée comme tu peux le voir...
tonymx15 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 05/12/2010, 14h40   #4
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 817
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

Informations professionnelles :
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : mars 2005
Messages : 2 817
Points : 3 442
Points : 3 442
Citation:
Non le graphique ne s'affiche pas ça m'affiche un texte avec des caractères spéciaux...
Probablement parce que $graph->draw() envoie les données de l'image au sein de ta page HTML.
Pour éviter cela il faudrait passer par un script PHP inclus en <img>.
__________________
Un problème exposé clairement est déjà à moitié résolu
Keep It Smart and Simple
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/12/2010, 08h44   #5
Candidat au titre de Membre du Club
 
Inscription : juin 2010
Messages : 102
Détails du profil
Informations personnelles :
Âge : 22

Informations forums :
Inscription : juin 2010
Messages : 102
Points : 13
Points : 13
Où je peux trouver ce script ?
tonymx15 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 06/12/2010, 12h00   #6
Expert Confirmé
 
Avatar de Séb.
 
Inscription : mars 2005
Messages : 2 817
Détails du profil
Informations personnelles :
Âge : 34
Localisation : France

Informations professionnelles :
Secteur : High Tech - Opérateur de télécommunications

Informations forums :
Inscription : mars 2005
Messages : 2 817
Points : 3 442
Points : 3 442
Le script tu l'as déjà fait. Il suffit de le mettre dans un fichier graphe.php que tu appelleras ainsi :

Code :
<img src="graphe.php?param1=value1&param2=value2"...>
Sans oublier d'envoyer le Content-Type qui va bien avec header( ).
__________________
Un problème exposé clairement est déjà à moitié résolu
Keep It Smart and Simple
Séb. est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 15/12/2010, 10h13   #7
Candidat au titre de Membre du Club
 
Inscription : juin 2010
Messages : 102
Détails du profil
Informations personnelles :
Âge : 22

Informations forums :
Inscription : juin 2010
Messages : 102
Points : 13
Points : 13
ok, merci.
tonymx15 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h33.


 
 
 
 
Partenaires

Hébergement Web