source: trunk/xgraph/jpgraph/Examples/example3.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 990 bytes
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_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
17// Setup margin and titles
18$graph->SetMargin(40,20,20,40);
19$graph->title->Set('Calls per operator');
20$graph->subtitle->Set('(March 12, 2008)');
21$graph->xaxis->title->Set('Operator');
22$graph->yaxis->title->Set('# of calls');
23
24$graph->yaxis->title->SetFont( FF_FONT1 , FS_BOLD );
25$graph->xaxis->title->SetFont( FF_FONT1 , FS_BOLD );
26
27// Create the linear plot
28$lineplot=new LinePlot($ydata);
29$lineplot->SetColor( 'blue' );
30$lineplot->SetWeight( 2 );   // Two pixel wide
31
32
33// Add the plot to the graph
34$graph->Add($lineplot);
35
36// Display the graph
37$graph->Stroke();
38?>
Note: See TracBrowser for help on using the repository browser.