Précédent   Forum des professionnels en informatique > PHP > PHP & SGBD > PHP & MySQL
PHP & MySQL Forum d'entraide sur les fonctions MySQL avec PHP. Avant de poster -> FAQ MySQL, Cours MySQL et Sources MySQL. Pour les questions concernant le moteur MySQL plutôt que les fonctions PHP, merci d'utiliser le forum MySQL.
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 01/09/2011, 13h30   #1
Membre à l'essai
 
Inscription : janvier 2006
Messages : 120
Détails du profil
Informations forums :
Inscription : janvier 2006
Messages : 120
Points : 24
Points : 24
Par défaut pchart combinaison impossible tableau avec graphique

Bonjour,

je suis en train d'utiliser la librairie pchart. Je me suis rendu compte que lorsque je souhaite combiner un tableau et un graphique pchart, la librairie pchart génère un .png vide contenant uniquement les axes des coordonnées XY.

Je voulais savoir si quelqu'un a déjà eu ce problème et si vous êtes déjà arrivé à le résoudre

J'ai découpé mon code 2 parties, la partie qui gère le tableau des résultat (stat.php) et la partie graphique mypChartScript.php.


stat.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
 
<html>
<head><title>test</title></head>
<body>
<?php
require_once "config.php";
 
$age1 = $_POST["age1"];
 
foreach($_POST['admin'] as $categ){
//random key
$key=rand();
 
echo "$categ <br/>";
$sql = "select count(distinct `IDPat`) as Nombre, annee, CIMO from export where CIMO like '".$categ."'
and age>=".$age1."
group by annee order by annee desc";
$result = mysql_query($sql) or die(mysql_error());
$Nombre="";
$annee="";
 
echo "<table border='1'>
<tr>
<th>Nombre</th>
<th>annee</th>
<th>CIMO</th>
 
</tr>";
while($row = mysql_fetch_assoc($result))
  {
echo "<tr>";
  echo "<td>" . $row['Nombre'] . "</td>";
  echo "<td>" . $row['annee'] . "</td>";
  echo "<td>" . $row['CIMO'] . "</td>";
 
echo "</tr>";
 
}
echo "</table>";
echo "<br/><br/>";
 
while($rowz = mysql_fetch_array($result)) {
$Nombre[] = $rowz['Nombre'];
$annee[] = $rowz['annee'];
 
}
include "mypChartScript.php";
}//end foreach
 
mysql_close($con)
 
?>
 
<IMG SRC='mypChartScript.php'>
</body>
</html>
mypChartScript.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
 
<?php
 
include("pChart/pData.class");
include("pChart/pChart.class");
$DataSet = new pData();
$DataSet->AddPoint($Nombre,"Nombre");
$DataSet->AddPoint($annee,"Annee");
$DataSet->AddAllSeries();
$DataSet->RemoveSerie("Annee");
$DataSet->SetAbsciseLabelSerie("Annee");
$DataSet->SetSerieName("Nombre","Nombre"); 
$DataSet->SetYAxisName("Nombre");
// Initialise the graph
$Test = new pChart(700,230);
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->setGraphArea(50,30,585,200);
$Test->drawFilledRoundedRectangle(7,7,693,223,5,240,240,240);
$Test->drawRoundedRectangle(5,5,695,225,5,230,230,230);
$Test->drawGraphArea(255,255,255,TRUE);
$Test->drawScale($DataSet->GetData(),$DataSet->GetDataDescription(),SCALE_NORMAL,150,150,150,TRUE,0,2,TRUE);
$Test->drawGrid(4,TRUE,230,230,230,50);
 
// Draw the 0 line
$Test->setFontProperties("Fonts/tahoma.ttf",6);
$Test->drawTreshold(0,143,55,72,TRUE,TRUE);
 
// Draw the bar graph
$Test->drawBarGraph($DataSet->GetData(),$DataSet->GetDataDescription());
 
// Finish the graph
$Test->setFontProperties("Fonts/tahoma.ttf",8);
$Test->drawLegend(600,30,$DataSet->GetDataDescription(),255,255,255);
$Test->setFontProperties("Fonts/tahoma.ttf",10);
$Test->drawTitle(50,22,"Example",50,50,50,585);
$Test->Render("example.png");
?>
Jarod51 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 18h26.


 
 
 
 
Partenaires

Hébergement Web