Précédent   Forum des professionnels en informatique > PHP > Bibliothèques et frameworks > Images > JpGraph
JpGraph Forum d'entraide pour la bibliothèque JpGraph permettant de manipuler des images en PHP. Avant de poster -> tutoriels JpGraph
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 27/04/2007, 20h01   #1
Nouveau Membre du Club
 
Inscription : février 2007
Messages : 219
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 219
Points : 32
Points : 32
Par défaut [JpGraph] Graphique et pdf

Bonjour,
Je créer des graphiques qui changent tous les jours en fonction des données que j'ai dans ma base de données.Donc je créer mon graphique jpgraph et pour l'instant je génère une image que je réutilise pour créer mon pdf après.Donc mon problème est qu'avec easy php ça marche mais lorsque je met en ligne ça ne marche plus,le graphique ne change pas. Donc il y aurait t-il un autre moyen de réaliser le graphique et de ne pas générer une image et qui puisse être réutiliser pour mon pdf???

Voici le graphique:
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
57
58
59
60
61
62
63
64
65
66
67
include ("autres_graphs/jpgraph-1.21b/src/jpgraph.php");
include ("autres_graphs/jpgraph-1.21b/src/jpgraph_bar.php");
setlocale (LC_ALL, 'et_EE.ISO-8859-1');
 
$data1y=array($tableau[1][1],$tableau[2][1],$tableau[3][1],$tableau[4][1]);
$data2y=array($tableau[1][2],$tableau[2][2],$tableau[3][2],$tableau[4][2]);
$data3y=array($tableau[1][3],$tableau[2][3],$tableau[3][3],$tableau[4][3]);
 
// Create the graph. These two calls are always required
$graph = new Graph(600,400,"auto");    
$graph->SetScale("textlin");
 
$graph->SetShadow();
$graph->img->SetMargin(60,140,60,60);
 
 
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetLegend("Gard-Crau");
$b1plot->SetFillColor("white");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("darkorange1");
$b2plot->SetLegend("Roussillon");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillColor("darkorchid3");
$b3plot->SetLegend("Vallée Rhône");
 
 
$b1plot->value->Show();
$b1plot->value->SetFormat('%d');
$b1plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b1plot->value->SetAngle(45);
$b2plot->value->Show();
$b2plot->value->SetFormat('%d');
$b2plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b2plot->value->SetAngle(45);
$b3plot->value->Show();
$b3plot->value->SetFormat('%d');
$b3plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b3plot->value->SetAngle(45);
 
$graph->SetColor("gray9");
$graph->SetMarginColor("gray8");
 
$graph->legend->Pos(0.03,0.5,"right","center");
$graph->legend->SetFont(FF_FONT1,FS_BOLD);
 
// Create the grouped bar plot
$gbplot = new GroupBarPLot(array($b1plot,$b2plot,$b3plot));
$lbl = array("NB","NJ","PB","PJ");
$graph->xaxis->SetTickLabels($lbl);
 
// and add it to the graPH
$graph->Add($gbplot);
 
$graph->title->Set("Prévisions des apports de la semaine $ww par variétés
 Ecopêche Campagne $aa");
$graph->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->yaxis->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->yaxis->SetTitle('Tonnes','center','left');
$graph->yaxis->SetTitlemargin(40);
$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->xaxis->SetTitle('Variétés','center','bottom'); 
$graph->xaxis->SetTitlemargin(10);
 
// Display the graph
$graph->Stroke("graph_prev_variete.png");
Et comment je l'intègre dans mon pdf:
Code :
$pdf->Image('../graph_prev_variete.png',50,25,120);
coco38 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 27/04/2007, 23h57   #2
Nouveau Membre du Club
 
Inscription : juillet 2004
Messages : 50
Détails du profil
Informations personnelles :
Localisation : France, Loire Atlantique (Pays de la Loire)

Informations forums :
Inscription : juillet 2004
Messages : 50
Points : 28
Points : 28
Je pense que la librairie gd n'est pas installée chez l'hebergeur de ton site.
Par conséquent, tu ne pourras pas creer de graph que ce soit avec jpgraph ou artichow qui necessitent cette librairie GD.

Je vois donc deux solutions à ton problème :
1 - génerer ton graph en local sur ton pc et mettre en ligne l'image générée.
2 - changer d'hebergeur.
fab44 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 28/04/2007, 09h05   #3
Nouveau Membre du Club
 
Inscription : février 2007
Messages : 219
Détails du profil
Informations forums :
Inscription : février 2007
Messages : 219
Points : 32
Points : 32
Mis moi je l'ai installé la librairie jpgraph. Le problème est que je génère chaque jour un graphique différent donc il m'est impossible de le mettre chaque jour en ligne...Merci je vais y réfléchir.
coco38 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 13h45.


 
 
 
 
Partenaires

Hébergement Web