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
| <?php $tab=array();
foreach($tableau as $value) {
foreach($value as $k=>$v) {
$tab[$k][]=$v; } }
?>
<?php
include ("jpgraph-1.21b/src/jpgraph.php");
include ("jpgraph-1.21b/src/jpgraph_line.php");
setlocale (LC_ALL, 'et_EE.ISO-8859-1');
$data1y=$tab[1];
$data2y=$tab[2];
// Create the graph. These two calls are always required
$graph = new Graph(800,400,"auto");
$graph->SetScale("textlin");
$graph->SetShadow();
$graph->img->SetMargin(60,170,60,60);
// Create the bar plots
$b1plot = new LinePlot($data1y);
$b1plot->SetLegend("Totals apports");
$b1plot->SetColor("darkorange1");
$b2plot = new LinePlot($data2y);
$b2plot->SetColor("blue");
$b2plot->SetLegend("Totals sorties");
$graph->Add($b1plot);
$graph->Add($b2plot);
$graph->SetBackgroundGradient('#9999FF','white',GRAD_HOR,BGRAD_MARGIN);
$graph->legend->Pos(0.03,0.5,"right","center");
$graph->legend->SetFont(FF_FONT1,FS_BOLD);
$datax=$tab[0];
$graph->xaxis->SetTickLabels($datax);
$graph->xaxis->SetFont(FF_ARIAL,FS_NORMAL,8);
$graph->xaxis->SetLabelAngle(45);
$graph->title->Set("Evolution des flux quotidiens
Ecopêche Campagne 2006");
$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);
// Display the graph
$graph->Stroke("graph.png");
echo "<img src='graph.png' />";
?> |
Partager