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