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
|
<?php
session_start();
include ("../jpgraph/src/jpgraph.php");
include ("../jpgraph/src/jpgraph_line.php");
$tab_dataresem=$_SESSION['dataresem'];
// fonction pour extraire les données de la variable session
$tbms = array(); // initialisé la variable
array_walk_recursive($tab_dataresem, function ($val, $key) use (&$tbms){
if ('Total_M' === $key) {
$tbms[] = $val;
}
}, $tbms);
// fin fonction
$ns = array(); // initiation du tableau semaine
$tbm = array(); // initiation du tableau total masculin
// listé les semaines en dur
$ns = array('1','2','3','4','5','6','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');
// meme chose pour le tableau masculin
$tbm = array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
// affectation des données
$tbm= $tbms;
// Création du graphique
// Création du conteneur
$gJpgBrandTiming=true;
$graph = new Graph(800,350,"auto");
$graph->img->SetMargin(60,30,40,40); // Fixer les marges
$graph->img->SetAntiAliasing("white"); // Lissage sur fond blanc (évite la pixellisation)
$graph->title->SetFont(FF_ARIAL,FS_BOLD,10); // Apparence de la police
$graph->title->SetMargin(10); // decaler le titre du haut avec 10 unitées
$graph->SetScale('textlin'); // A détailler
$graph->SetShadow(); // Ajouter une ombre
$graph->title->Set("Evolution du nombre de cas par semaines"); // Ajouter le titre du graphique
$graph->ygrid->SetFill(true,'#EFEFEF@0.9','#BBCCFF@0.9');
// legend graphe
$graph->legend->Pos(0.10,0.10,"right","top");
$graph->legend->SetLayout('LEGEND_VERT');
$graph->legend->SetLineSpacing(2);
$graph->legend->SetColor('blue');
$graph->legend->SetShadow('darkgray@0.10');
$graph->legend->SetFillColor('lightblue@0.2');
// Afficher la grille de l'axe des ordonnées Y
$graph->ygrid->Show();
$graph->ygrid->SetColor('blue'); // Fixer la couleur de l'axe (bleu avec transparence : @0.0)
//$graph->ygrid->SetLineStyle('dotted'); // Des tirets pour les lignes
$graph->yscale->SetGrace(1,0); // ajouter 2% a l'echelle automatique
$graph->yaxis->title->Set("Nb cas");
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->yaxis->SetWeight(2);
$graph->yaxis->title->Setmargin(15);
// Afficher la grille de l'axe des abscisses X
$graph->xgrid->Show();
$graph->xgrid->SetColor('red'); // Fixer la couleur de l'axe (rouge avec transparence : @0.2)
$graph->xgrid->SetLineStyle('dotted'); // Des tirets pour les lignes
$graph->xaxis->title->Set("NSem");
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
$graph->xaxis->SetLabelAngle(40);
$graph->xaxis->SetTickLabels($ns); // affecter numéro de semaine a l'axe des absisses
$graph->tabtitle->Set(' Année a affichée ' );
$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,13);
// Créer une courbes masculin
$courbe = new LinePlot($tbm);
$graph->Add($courbe);
//$courbe->value->Show(); // Afficher les valeurs pour chaque point
// Valeurs: Apparence de la police
//$courbe->value->SetFont(FF_ARIAL,FS_NORMAL,9);
//$courbe->value->SetFormat('%d');
//$courbe->value->SetColor('red');
// Chaque point de la courbe ****
//$courbe->mark->SetType(MARK_STAR); // Type de point
$courbe->mark->SetFillColor("#FFA700"); // Couleur de remplissage
$courbe->mark->SetWidth(4); // Taille
$courbe->SetColor("blue"); // Couleur de la courbe
$courbe->SetCenter(0.5);
$courbe->SetLegend('Total Masculin');
$graph->Stroke();
?> |
Partager