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();
?> |
Partager