JPGRAPH ...??2 graphes sur meme page??

Sinse2004 Messages postés 21 Date d'inscription lundi 14 juin 2004 Statut Membre Dernière intervention 23 août 2004 - 2 juil. 2004 à 16:45
bizerta Messages postés 2 Date d'inscription mercredi 15 novembre 2000 Statut Membre Dernière intervention 18 mai 2005 - 18 mai 2005 à 16:31
Salut,
J`essaye de faire des graphiques pour editer des stats a partir de ma BD MySQL, et on ma dit d`utiliser JPGRAPH(car super facile d`utilisation!!....pas pour moi en tout cas! ;-)
Bon, grace a un copier-coller(d`un script php trouver sur un forum), j`arrive a afficher un graphique. MAIS comment faire pour en afficher plusieurs sur la meme page??
Voila mon code ki permet l`affichage d`un graphique:
<?
include("config.php");
include ( "./JPGRAPH/src/jpgraph.php");
include ("./JPGRAPH/src/jpgraph_pie.php");
//include ("./JPGRAPH/src/jpgraph_line.php");

$SQL = "SELECT count(id_cr), status FROM cr_status GROUP BY status";
$RESULT = mysql_query($SQL);
if ($myrow=mysql_fetch_array($RESULT)) {
do {
$data[] = $myrow[0]; //It would not create the graphs without using '[]'
$data_names[] = $myrow[1]."(".$myrow[0].")";
}while ($myrow=mysql_fetch_array($RESULT));
}

// Create the Pie Graph.
$graph = new PieGraph(520,400,$filename,60);
$graph->SetShadow();

$PIE_TITLE="Graphique of the status of the CR";

// Set A title for the plot
$graph->title->Set($PIE_TITLE);
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Create
$p1 = new PiePlot($data);
$p1->SetCenter(0.35,0.5);
$p1->SetLegends($data_names);

$p1->SetTheme("earth");

$graph->Add($p1);
$graph->Stroke();
?>

Si qqun peut m`aider ca serait cool, Merci
8-)

4 réponses

mageonyme Messages postés 121 Date d'inscription samedi 10 janvier 2004 Statut Membre Dernière intervention 1 décembre 2009
4 juil. 2004 à 13:23
je ne comprend pas ton pb ??? pkoi ne peux tu pas en mettre plusieurs ???
0
Sinse2004 Messages postés 21 Date d'inscription lundi 14 juin 2004 Statut Membre Dernière intervention 23 août 2004
5 juil. 2004 à 13:41
Salut,
ben en fait , j`arrive pas a afficher 2 graphiques sur la meme page !
Apres le code ci-dessus, je mets ca:...

$SQL = "SELECT id_dc, name_dc FROM data_center";
$RESULT = mysql_query($SQL);
if ($myrow=mysql_fetch_array($RESULT)) {
do {
$data2[] = $myrow[0]; //It would not create the graphs without using '[]'
$data_names2[] = $myrow[1]."(".$myrow[0].")";
}while ($myrow=mysql_fetch_array($RESULT));
}

// Create the Pie Graph.
$graph = new PieGraph(520,400,$filename,60);
$graph->SetShadow();

$PIE_TITLE="Graphique of the data center";

// Set A title for the plot
$graph->title->Set($PIE_TITLE);
$graph->title->SetFont(FF_FONT1,FS_BOLD);

// Create
$p2 = new PiePlot($data2);
$p2->SetCenter(0.35,0.5);
$p2->SetLegends($data_names2);

$p2->SetTheme("earth");

$graph->Add($p2);
$graph->Stroke();

....et ca m`affiche simplement le dernier graphe, le premier ne s`affiche pas ! Ca doit etre un truc tout be-bete, mais j`y arrive. Si tu peux m`aider, ca serait cool,
Merci
0
dounit Messages postés 20 Date d'inscription mardi 19 avril 2005 Statut Membre Dernière intervention 10 mai 2005
16 mai 2005 à 15:06
bonjour je suis débutante en php et moi aussi je dois utiliser des
graphe.jé installer GPGraph mé je ne sé pas commen tl'utiliser ni ou le
mettre sur mon disque vous voulez bien m'aider merci
0
bizerta Messages postés 2 Date d'inscription mercredi 15 novembre 2000 Statut Membre Dernière intervention 18 mai 2005
18 mai 2005 à 16:31
0
Rejoignez-nous