Bonjour,
Je débute en programmation et je souhaite réaliser une courbe de poids de personnes avec Jpgraph donc sur l'axe des X ce serait la date (pour tester j'ai mi juste 3 valauers A/B/C car je n'ai que 3 IMC)et sur l'axe des Y ce serait l'IMC..
Par contre j'ai un message d'erreur qui s'affiche: JpGraph Error: 25068 A plot has an illegal scale. This could for example be that you are trying to use text auto scaling to draw a line plot with only one point or that the plot area is too small. It could also be that no input data value is numeric (perhaps only '-' or 'x')
J'arrive à recueillir les données que je souhaite depuis ma base de données, mais pas à les transformer en courbe;
Je vous donne mon code en espérant qu'une personne puisse m'aider!!
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
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
70 <?php // content="text/plain; charset=utf-8" require_once ('jpgraph/src/jpgraph.php'); require_once ('jpgraph/src/jpgraph_line.php'); try { $bdd = new PDO('mysql:host=localhost;dbname=nutrition;charset=utf8', 'root', ''); } catch(Exception $e) { die('Erreur : '.$e->getMessage()); } if(isset($_GET['patient'])) { $infopatient=$bdd->query("SELECT * FROM (patient) WHERE id=".$_GET['patient']); while($donnees=$infopatient->fetch()) { $nom_du_patient=$donnees['nom']; $prenom_du_patient=$donnees['prenom']; $naissance_du_patient=$donnees['date_naissance']; $imc=$donnees['imc']; } $datay1=0; $affichagePatient=$bdd->query("SELECT * FROM patient WHERE nom IN ('".$nom_du_patient."') AND prenom IN ('".$prenom_du_patient."') AND date_naissance IN ('".$naissance_du_patient."') ORDER BY date ASC"); while($donneesPatient=$affichagePatient->fetch()){ $valeur=$donneesPatient['imc']; $date=$donneespatient['date']; $dataY = $valeur; $dataX = $date; } } // Setup the graph $graph = new Graph(800,650); $graph->SetScale("textlin"); $theme_class=new UniversalTheme; $graph->SetTheme($theme_class); $graph->img->SetAntiAliasing(false); $graph->title->Set('Courbes'); $graph->SetBox(false); $graph->img->SetAntiAliasing(); $graph->yaxis->HideZeroLabel(); $graph->yaxis->HideLine(true); $graph->yaxis->HideTicks(false,false); $graph->xgrid->Show(); $graph->xgrid->SetLineStyle("solid"); $graph->xaxis->SetTickLabels(array('A','B','C')); $graph->xgrid->SetColor('#E3E3E3'); // Create the first line $p1 = new LinePlot($dataY); $graph->Add($p1); $p1->SetColor("#6495ED"); $p1->SetLegend('IMC'); $graph->legend->SetFrameWeight(1); // Output line $graph->Stroke(); ?>
Partager