IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Bibliothèques et frameworks PHP Discussion :

[JpGraph] Graphique et pdf


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre du Club
    Profil pro
    Inscrit en
    Février 2007
    Messages
    219
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 219
    Points : 61
    Points
    61
    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 : 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
    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 : Sélectionner tout - Visualiser dans une fenêtre à part
    $pdf->Image('../graph_prev_variete.png',50,25,120);

  2. #2
    Membre du Club
    Profil pro
    Inscrit en
    Juillet 2004
    Messages
    54
    Détails du profil
    Informations personnelles :
    Localisation : France, Loire Atlantique (Pays de la Loire)

    Informations forums :
    Inscription : Juillet 2004
    Messages : 54
    Points : 45
    Points
    45
    Par défaut
    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.

  3. #3
    Membre du Club
    Profil pro
    Inscrit en
    Février 2007
    Messages
    219
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Février 2007
    Messages : 219
    Points : 61
    Points
    61
    Par défaut
    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.

+ Répondre à la discussion
Cette discussion est résolue.

Discussions similaires

  1. Exporter un composant webpart graphique en PDF
    Par Wnejla dans le forum SharePoint
    Réponses: 1
    Dernier message: 30/04/2013, 16h39
  2. Exporter un graphique en pdf en conservant la mise en forme
    Par alpking dans le forum Macros et VBA Excel
    Réponses: 0
    Dernier message: 06/07/2012, 09h39
  3. [JpGraph] jpgraph : graphiques en boucle sur la même page
    Par fred480 dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 19/11/2010, 21h12
  4. Réponses: 14
    Dernier message: 18/12/2008, 10h46
  5. [Graphique] Convertir pdf en image
    Par anykeyh dans le forum Graphisme
    Réponses: 5
    Dernier message: 18/01/2006, 16h51

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo