1 |
aurelien |
1 |
<?
|
|
|
2 |
$jpgraph = "/usr/local/lib/php/jpgraph-1.17";
|
|
|
3 |
include ("$jpgraph/jpgraph.php");
|
|
|
4 |
include ("$jpgraph/jpgraph_line.php");
|
|
|
5 |
|
|
|
6 |
// Some data
|
|
|
7 |
$ydata = array(11,3, 8,12,5 ,1,9, 13,5,7 );
|
|
|
8 |
|
|
|
9 |
// Create the graph. These two calls are always required
|
|
|
10 |
$graph = new Graph(350, 250,"auto");
|
|
|
11 |
$graph->SetScale( "textint");
|
|
|
12 |
|
|
|
13 |
$annees = array('2000','2005','2010');
|
|
|
14 |
$graph->xaxis->SetTickLabels($annees);
|
|
|
15 |
|
|
|
16 |
// Create the linear plot
|
|
|
17 |
$lineplot =new LinePlot($ydata);
|
|
|
18 |
$lineplot ->SetColor("blue");
|
|
|
19 |
|
|
|
20 |
// Add the plot to the graph
|
|
|
21 |
$graph->Add( $lineplot);
|
|
|
22 |
|
|
|
23 |
//Un peu de forme
|
|
|
24 |
$graph->title->Set("Date de floraison du pommier");
|
|
|
25 |
$graph->img->SetMargin(40,20,20,40);
|
|
|
26 |
$graph->xaxis->title->Set("Année");
|
|
|
27 |
$graph->yaxis->title->Set("Date observée");
|
|
|
28 |
$graph->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
29 |
$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
30 |
$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
|
|
|
31 |
$lineplot->mark->SetType(MARK_SQUARE);
|
|
|
32 |
|
|
|
33 |
// Display the graph
|
|
|
34 |
$graph->Stroke();
|
|
|
35 |
?>
|