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 :

image Jpgraph non apparue


Sujet :

Bibliothèques et frameworks PHP

  1. #1
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2013
    Messages
    34
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juillet 2013
    Messages : 34
    Points : 24
    Points
    24
    Par défaut image Jpgraph non apparue
    SVP j'arrive pas à comprendre pourquoi ce script ne m'affiche le resultat sachant que la connexion à la base de données est bon, aussi la requête à bien passé tout fonctionne mais j'obtiens un petit icone d'une image .Merci trop bien pour votre réponse.


    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
    71
     
    <?php
    include '../jpgraph/src/jpgraph.php';
    include '../jpgraph/src/jpgraph_line.php';
    include '../commande/commande.php';
    include '../connexionDB.php';
     
    // *********************
    // Production de données
    // *********************
     
    $tx=array();
    $rx=array();
    $temps=array();
     
     
     
    $req="SELECT tx,rx,time,date FROM interfaces WHERE id_server='1' AND nom_int='eth0';";
    if($result = mysql_query($req)){
    while($ligne = mysql_fetch_array($result)){
    $tx[]=$ligne[0];
    $rx[]=$ligne[1];
    $temps[]=$ligne[2]."\n".$ligne[3];
     
    }}
    $graph = new Graph(900,500);
    $graph->img->SetMargin(40,30,50,40);    
    $graph->img->SetAntiAliasing("white");
    $graph->SetScale("textlin");
    $graph->SetShadow();
    $graph->title->Set('eth0');
     
    $graph->ygrid->Show();
    $graph->ygrid->SetColor('blue@0.7');
    $graph->ygrid->SetLineStyle('dashed');
     
     
    $graph->xgrid->Show();
    $graph->xgrid->SetColor('red@0.7');
    $graph->xgrid->SetLineStyle('dashed');
     
     
    $graph->title->SetFont(FF_ARIAL,FS_BOLD,11);
     
     
    $courbeTx = new LinePlot($tx);
    $courbeTx->value->Show();
    $courbeTx->SetLegend('tx');
    $courbeTx->SetColor("blue");
    $courbeTx->SetCenter();
     
    $courbeRx = new LinePlot($rx);
    $courbeRx->value->Show();
    $courbeRx->SetLegend('rx');
    $courbeRx->SetColor("red");
    $courbeRx->SetCenter();
     
     
    $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
    $graph->yaxis->SetTitle("Block");
     
    $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
    $graph->xaxis->SetTickLabels($temps);
    $graph->xaxis->SetTextLabelInterval(5);
     
    // Ajouter la courbe au conteneur
    $graph->Add($courbeRx);
    $graph->Add($courbeTx);
     
    $graph->Stroke();
    ?>

  2. #2
    Expert éminent sénior
    Avatar de mathieu
    Profil pro
    Inscrit en
    Juin 2003
    Messages
    10 235
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juin 2003
    Messages : 10 235
    Points : 15 532
    Points
    15 532
    Par défaut
    mets des données de tests dans les tableaux pour qu'on puisse tester de notre coté.

  3. #3
    Membre à l'essai
    Femme Profil pro
    Étudiant
    Inscrit en
    Juillet 2013
    Messages
    34
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : Maroc

    Informations professionnelles :
    Activité : Étudiant
    Secteur : High Tech - Produits et services télécom et Internet

    Informations forums :
    Inscription : Juillet 2013
    Messages : 34
    Points : 24
    Points
    24
    Par défaut
    Voila avec des données fictives:
    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
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    <?php
    include "../jpgraph/src/jpgraph.php";
     
    include "../jpgraph/src/jpgraph_line.php";
     
    include "../commande/commande.php";
     
    include "../connexionDB.php";
     
     
     
    $tx=array(1,3,6,4,9,36,38,7,34,32,8,37,1,4,5);
     
    $rx=array(1,2,1,3,3,4,3,4,5,4,6,5,7,6,5);
     
    $temps=array(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1);
     
     
     
    $req="SELECT tx,rx,time,date FROM interfaces WHERE id_server='1' AND nom_int='eth0';";
     
     
    //if($result = mysql_query($req)){
     
    //while($ligne = mysql_fetch_array($result)){
     
    //$tx[]=$ligne[0];
     
    //$rx[]=$ligne[1];
     
    //$temps[]=$ligne[2]."\n".$ligne[3];
     
     
    //}}
     
     
    $graph = new Graph(900,500);
     
    $graph->img->SetMargin(40,30,50,40);
     
    $graph->img->SetAntiAliasing("white");
     
    $graph->SetScale("textlin");
     
    $graph->SetShadow();
     
    $graph->title->Set("eth0");
     
     
     
     
     
     
    $graph->ygrid->Show();
     
    $graph->ygrid->SetColor('blue@0.7');
     
    $graph->ygrid->SetLineStyle('dashed');
     
     
     
    $graph->xgrid->Show();
     
    $graph->xgrid->SetColor('red@0.7');
     
    $graph->xgrid->SetLineStyle('dashed');
     
     
     
    $graph->title->SetFont(FF_ARIAL,FS_BOLD,11);
     
     
     
    $courbeTx = new LinePlot($tx);
     
    $courbeTx->value->Show();
     
    $courbeTx->SetLegend('tx');
     
    $courbeTx->SetColor("blue");
     
    $courbeTx->SetCenter();
     
     
    $courbeRx = new LinePlot($rx);
     
    $courbeRx->value->Show();
     
    $courbeRx->SetLegend('rx');
     
    $courbeRx->SetColor("red");
     
    $courbeRx->SetCenter();
     
     
     
    $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
     
    $graph->yaxis->SetTitle("Block");
     
     
    $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
     
    $graph->xaxis->SetTickLabels($temps);
     
    $graph->xaxis->SetTextLabelInterval(5);
     
     
    // Ajouter la courbe au conteneur
    $graph->Add($courbeRx);
     
    $graph->Add($courbeTx);
     
     
    $graph->Stroke();
     
     
    ?>
    Sachant que j'ai créer mon fichier comme ça:
    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
    71
    72
    73
    74
    75
    $fileInt=$_SESSION['selectedServ']."_".$nomInt.".php";
    $f='';
    if (file_exists("../graphes/".$fileInt)) {
        unlink("../graphes/".$fileInt);
    	$f=fopen("../graphes/".$fileInt,'w+');
    	} else {
    	$f=fopen("../graphes/".$fileInt,'w+');
    }
    fwrite($f,'
    <?php
    include "../jpgraph/src/jpgraph.php";'."\n".'
    include "../jpgraph/src/jpgraph_line.php";'."\n".'
    include "../commande/commande.php";'."\n".'
    include "../connexionDB.php";'."\n".'
     
    $tx=array();'."\n".'
    $rx=array();'."\n".'
    $temps=array();'."\n".'
     
    $req="SELECT tx,rx,time,date FROM interfaces WHERE id_server=\''.$_SESSION["idSelectedServ"].'\' AND nom_int=\''.$nomInt.'\';";'."\n".'
     
    if($result = mysql_query($req)){'."\n".'
    while($ligne = mysql_fetch_array($result)){'."\n".'
    $tx[]=$ligne[0];'."\n".'
    $rx[]=$ligne[1];'."\n".'
    $temps[]=$ligne[2]."\n".$ligne[3];'."\n".'
     
    }}'."\n".'
     
     
    $graph = new Graph(900,500);'."\n".'
    $graph->img->SetMargin(40,30,50,40);'."\n".' 
    $graph->img->SetAntiAliasing("white");'."\n".'
    $graph->SetScale("textlin");'."\n".'
    $graph->SetShadow();'."\n".'
    $graph->title->Set("'.$nomInt.'");'."\n".'
     
    $graph->ygrid->Show();'."\n".'
    $graph->ygrid->SetColor(\'blue@0.7\');'."\n".'
    $graph->ygrid->SetLineStyle(\'dashed\');'."\n".'
    
    $graph->xgrid->Show();'."\n".'
    $graph->xgrid->SetColor(\'red@0.7\');'."\n".'
    $graph->xgrid->SetLineStyle(\'dashed\');'."\n".'
    
    $graph->title->SetFont(FF_ARIAL,FS_BOLD,11);'."\n".'
    
    $courbeTx = new LinePlot($tx);'."\n".'
    $courbeTx->value->Show();'."\n".'
    $courbeTx->SetLegend(\'tx\');'."\n".'
    $courbeTx->SetColor("blue");'."\n".'
    $courbeTx->SetCenter();'."\n".'
    
    $courbeRx = new LinePlot($rx);'."\n".'
    $courbeRx->value->Show();'."\n".'
    $courbeRx->SetLegend(\'rx\');'."\n".'
    $courbeRx->SetColor("red");'."\n".'
    $courbeRx->SetCenter();'."\n".'
    
    
    $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);'."\n".'
    $graph->yaxis->SetTitle("Block");'."\n".'
    
    $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);'."\n".'
    $graph->xaxis->SetTickLabels($temps);'."\n".'
    $graph->xaxis->SetTextLabelInterval(5);'."\n".'
    
    // Ajouter la courbe au conteneur
    $graph->Add($courbeRx);'."\n".'
    $graph->Add($courbeTx);'."\n".'
    
    $graph->Stroke();'."\n".'
    
    ?>');
    fclose($f);

Discussions similaires

  1. [Dates] Fonction date non apparue
    Par kev484 dans le forum Langage
    Réponses: 2
    Dernier message: 13/12/2007, 18h43
  2. [GD] thumbnail : Problème d'image JPEG non valide
    Par Commodore dans le forum Bibliothèques et frameworks
    Réponses: 19
    Dernier message: 09/08/2006, 11h41
  3. [JpGraph] poster un tableau dans une image JpGraph
    Par hokidoki dans le forum Bibliothèques et frameworks
    Réponses: 2
    Dernier message: 04/07/2006, 15h46
  4. [Images] JpGraph ou Artichow ?
    Par UNi[FR] dans le forum Bibliothèques et frameworks
    Réponses: 6
    Dernier message: 11/04/2006, 16h10
  5. [APACHE 2] Images / Css Non affichée
    Par djshaker dans le forum Apache
    Réponses: 1
    Dernier message: 22/02/2006, 15h26

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