1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
4 | |
---|
5 | // Some (random) data |
---|
6 | $ydata = array(11,3,8,12,5,1,9,13,5,7); |
---|
7 | |
---|
8 | // Size of the overall graph |
---|
9 | $width=350; |
---|
10 | $height=250; |
---|
11 | |
---|
12 | // Create the graph and set a scale. |
---|
13 | // These two calls are always required |
---|
14 | $graph = new Graph($width,$height); |
---|
15 | $graph->SetScale('intlin'); |
---|
16 | $graph->SetShadow(); |
---|
17 | |
---|
18 | // Setup margin and titles |
---|
19 | $graph->SetMargin(40,20,20,40); |
---|
20 | $graph->title->Set('Calls per operator'); |
---|
21 | $graph->subtitle->Set('(March 12, 2008)'); |
---|
22 | $graph->xaxis->title->Set('Operator'); |
---|
23 | $graph->yaxis->title->Set('# of calls'); |
---|
24 | |
---|
25 | $graph->yaxis->title->SetFont( FF_FONT1 , FS_BOLD ); |
---|
26 | $graph->xaxis->title->SetFont( FF_FONT1 , FS_BOLD ); |
---|
27 | |
---|
28 | $graph->yaxis->SetColor('blue'); |
---|
29 | |
---|
30 | // Create the linear plot |
---|
31 | $lineplot=new LinePlot($ydata); |
---|
32 | $lineplot->SetColor( 'blue' ); |
---|
33 | $lineplot->SetWeight( 2 ); // Two pixel wide |
---|
34 | $lineplot->mark->SetType(MARK_UTRIANGLE); |
---|
35 | $lineplot->mark->SetColor('blue'); |
---|
36 | $lineplot->mark->SetFillColor('red'); |
---|
37 | |
---|
38 | $lineplot->value->Show(); |
---|
39 | |
---|
40 | // Add the plot to the graph |
---|
41 | $graph->Add($lineplot); |
---|
42 | |
---|
43 | // Display the graph |
---|
44 | $graph->Stroke(); |
---|
45 | ?> |
---|