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
| include ("autres_graphs/jpgraph-1.21b/src/jpgraph.php");
include ("autres_graphs/jpgraph-1.21b/src/jpgraph_bar.php");
setlocale (LC_ALL, 'et_EE.ISO-8859-1');
$data1y=array($tableau[1][1],$tableau[2][1],$tableau[3][1],$tableau[4][1]);
$data2y=array($tableau[1][2],$tableau[2][2],$tableau[3][2],$tableau[4][2]);
$data3y=array($tableau[1][3],$tableau[2][3],$tableau[3][3],$tableau[4][3]);
// Create the graph. These two calls are always required
$graph = new Graph(600,400,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(60,140,60,60);
// Create the bar plots
$b1plot = new BarPlot($data1y);
$b1plot->SetLegend("Gard-Crau");
$b1plot->SetFillColor("white");
$b2plot = new BarPlot($data2y);
$b2plot->SetFillColor("darkorange1");
$b2plot->SetLegend("Roussillon");
$b3plot = new BarPlot($data3y);
$b3plot->SetFillColor("darkorchid3");
$b3plot->SetLegend("Vallée Rhône");
$b1plot->value->Show();
$b1plot->value->SetFormat('%d');
$b1plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b1plot->value->SetAngle(45);
$b2plot->value->Show();
$b2plot->value->SetFormat('%d');
$b2plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b2plot->value->SetAngle(45);
$b3plot->value->Show();
$b3plot->value->SetFormat('%d');
$b3plot->value->SetFont(FF_ARIAL,FS_BOLD);
$b3plot->value->SetAngle(45);
$graph->SetColor("gray9");
$graph->SetMarginColor("gray8");
$graph->legend->Pos(0.03,0.5,"right","center");
$graph->legend->SetFont(FF_FONT1,FS_BOLD);
// Create the grouped bar plot
$gbplot = new GroupBarPLot(array($b1plot,$b2plot,$b3plot));
$lbl = array("NB","NJ","PB","PJ");
$graph->xaxis->SetTickLabels($lbl);
// and add it to the graPH
$graph->Add($gbplot);
$graph->title->Set("Prévisions des apports de la semaine $ww par variétés
Ecopêche Campagne $aa");
$graph->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->yaxis->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->yaxis->SetTitle('Tonnes','center','left');
$graph->yaxis->SetTitlemargin(40);
$graph->xaxis->title->SetFont(FF_VERDANA,FS_BOLD);
$graph->xaxis->SetTitle('Variétés','center','bottom');
$graph->xaxis->SetTitlemargin(10);
// Display the graph
$graph->Stroke("graph_prev_variete.png"); |
Partager