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
| require_once("../include/Util.php");
require_once ("../include/jpgraph/jpgraph.php");
require_once ("../include/jpgraph/jpgraph_bar.php");
$count_ids_par_mois=array(5,8,4,12,3,6);
$somme_ids_par_mois=array(50,80,24,97,35,50);
$mois=array("janvier","fevrier","mars","avril","mai","juin");
// Size of graph
$width=400;
$height=500;
// Set the basic parameters of the graph
$graph = new Graph($width,$height);
$graph->SetScale('textlin');
$top = 60;
$bottom = 30;
$left = 80;
$right = 30;
// Nice shadow
$graph->SetShadow();
// Setup labels
$lbl = array($mois[0]."\n".$count_ids_par_mois[0]." ids",
$mois[1]."\n".$count_ids_par_mois[1]." ids",
$mois[2]."\n".$count_ids_par_mois[2]." ids",
$mois[3]."\n".$count_ids_par_mois[3]." ids",
$mois[4]."\n".$count_ids_par_mois[4]." ids",
$mois[5]."\n".$count_ids_par_mois[5]." ids");
$graph->xaxis->SetTickLabels($lbl);
// Label align for X-axis
$graph->xaxis->SetLabelAlign('right','center','right');
// Label align for Y-axis
$graph->yaxis->SetLabelAlign('center','bottom');
// Titles
$graph->title->Set('Number of incidents');
// Create a bar pot
$bplot = new BarPlot($somme_ids_par_mois);
$bplot->SetFillColor('orange');
$bplot->SetWidth(0.5);
// $bplot->SetYMin(1990);
$graph->Add($bplot);
$graph->Stroke(); |
Partager