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
| // Size of graph
$width=190;
$height=94;
// Set the basic parameters of the graph
$graph = new Graph($width,$height,'auto');
$graph->SetScale("textlin");
// No frame around the image
$graph->SetFrame(false);
$aShowShadow = false;
$aShadowWidth = 0;
$aShadowColor = array(255,255,255) ;
$graph->SetShadow($aShowShadow,$aShadowWidth,$aShadowColor);
// Rotate graph 90 degrees and set margin
$graph->Set90AndMargin(-0.2,-0.1,-1,-1);
// Use a box around the plot area
$graph->SetBox();
// Some extra margin looks nicer
$graph->xaxis->SetLabelMargin(0);
// We don't want to display Y-axis
$graph->yaxis->Hide();
// Now create a bar pot
$bplot = new BarPlot($datay);
//You can change the width of the bars if you like
$bplot->SetWidth(0.8);
// Alternance de couleur
$bplot->SetFillColor(array("#a6a7a8","#00537c", "#33929d", "#60ceda"));
// We want to display the value of each bar at the top
$bplot->value->Show();
$bplot->value->SetFont(FF_ARIAL,FS_BOLD,12);
//$bplot->value->SetAlign('left','center');
$bplot->value->SetColor("white");
$bplot->value->SetFormat('%.0f');
$bplot->SetValuePos('max');
// Add the bar to the graph
$graph->Add($bplot);
// .. and stroke the graph
$graph->Stroke(); |
Partager