| 1 |
lars |
1 |
<?php
|
|
|
2 |
include ("../jpgraph.php");
|
|
|
3 |
include ("../jpgraph_bar.php");
|
|
|
4 |
include ("../jpgraph_line.php");
|
|
|
5 |
|
|
|
6 |
$datay=array(2,3,5,8.5,11.5,6,3);
|
|
|
7 |
|
|
|
8 |
// Create the graph.
|
|
|
9 |
$graph = new Graph(460,400,'auto');
|
|
|
10 |
$graph->SetScale("textlin");
|
|
|
11 |
$graph->SetMargin(40,20,50,70);
|
|
|
12 |
|
|
|
13 |
$graph->legend->SetPos(0.5,0.97,'center','bottom');
|
|
|
14 |
|
|
|
15 |
$graph->title->Set('Plot line legend');
|
|
|
16 |
$graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
|
|
|
17 |
|
|
|
18 |
$graph->SetTitleBackground('lightblue:1.3',TITLEBKG_STYLE2,TITLEBKG_FRAME_BEVEL);
|
|
|
19 |
$graph->SetTitleBackgroundFillStyle(TITLEBKG_FILLSTYLE_HSTRIPED,'lightblue','navy');
|
|
|
20 |
|
|
|
21 |
// Create a bar pot
|
|
|
22 |
$bplot = new BarPlot($datay);
|
|
|
23 |
$bplot->value->Show();
|
|
|
24 |
$bplot->value->SetFont(FF_VERDANA,FS_BOLD,8);
|
|
|
25 |
$bplot->SetValuePos('top');
|
|
|
26 |
$bplot->SetLegend('Bar Legend');
|
|
|
27 |
$graph->Add($bplot);
|
|
|
28 |
|
|
|
29 |
$pline = new PlotLine(HORIZONTAL,8,'red',2);
|
|
|
30 |
$pline->SetLegend('Line Legend');
|
|
|
31 |
$graph->legend->SetColumns(10);
|
|
|
32 |
$graph->Add($pline);
|
|
|
33 |
|
|
|
34 |
$graph->Stroke();
|
|
|
35 |
?>
|