Bonjour;
Je suis en train de réaliser un graphique en forme de "camembert" avec JPGraph.
Le script de la page appelante (effectif.php):
La page camembert3d :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
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 //Inclusion des fichiers de connexion à la BdD require_once("fonctions/cnxGPEC.php"); //Repartition des arrivées par collége $qry_college = mysql_query("SELECT College, COUNT(NNI) AS nb FROM agents WHERE DateArriveeRetD BETWEEN '2005-01-01' AND '2005-12-31' AND UMprecedenteNiv1 != '' GROUP BY College ORDER BY College"); $i=0; $datax =''; $datay =''; while ($row = mysql_fetch_assoc($qry_college)) { $datax[$i] = "'".$row['College']."'"; $datay[$i] = "'".$row['nb']."'"; $i++; } //print_r($datax); ->Array ( [0] => 'Cadre' [1] => 'Maîtrise' ) //print_r($datay); ->Array ( [0] => '26' [1] => '10' ) echo "<html>\n<head></head>\n<body>\n"; echo '<img src="jpgraph/camembert3d.php?datax='.addslashes(urlencode(serialize($datax))).'&datay='.addslashes(urlencode(serialize($datay))).'" />'; echo "\n</body>\n</html>";
Lors de l'appel de la page effectif.php, j'ai le message suivant :
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22 include ("src/jpgraph.php"); include ("src/jpgraph_pie.php"); include ("src/jpgraph_pie3d.php"); $datax = isset($_GET['datax'])?unserialize(urldecode(stripslashes($_GET['datax']))):""; $datay = isset($_GET['datay'])?unserialize(urldecode(stripslashes($_GET['datay']))):""; $graph = new PieGraph(300,300); $graph->SetShadow(); $graph->title-> Set("Répartition des arrivées\n par collège"); $graph->title->SetFont(FF_ARIAL,FS_BOLD); $p1 = new PiePlot3D($datay); $p1->SetAngle(45); $p1->SetSize(0.5); $p1->SetCenter(0.45); $p1->SetLegends($datax); $p1->SetTheme('water'); $graph->Add( $p1); $graph->Stroke();
dans un joli dessin a fond bleuJpGraph error : Illegal pie plot. Sum of all data is zero for Pie!![]()
Par contre si j'insére mon require, la requete et le while dans "camembert.php" (en supprimant mes lignes de GET), j'obtiens bien mon graphique
![]()
Ou est mon erreur ?
Merci d'avance![]()







Répondre avec citation




Partager