source: trunk/xgraph/jpgraph/Examples/example4.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.2 KB
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$ydata2  = array(1, 19, 15, 7, 22, 14, 5, 9, 21, 13 );
8
9// Size of the overall graph
10$width=350;
11$height=250;
12
13// Create the graph and set a scale.
14// These two calls are always required
15$graph = new Graph($width,$height);
16$graph->SetScale('intlin');
17$graph->SetShadow();
18
19// Setup margin and titles
20$graph->SetMargin(40,20,20,40);
21$graph->title->Set('Calls per operator (June,July)');
22$graph->subtitle->Set('(March 12, 2008)');
23$graph->xaxis->title->Set('Operator');
24$graph->yaxis->title->Set('# of calls');
25
26$graph->yaxis->title->SetFont( FF_FONT1 , FS_BOLD );
27$graph->xaxis->title->SetFont( FF_FONT1 , FS_BOLD );
28
29// Create the first data series
30$lineplot=new LinePlot($ydata);
31$lineplot->SetWeight( 2 );   // Two pixel wide
32
33// Add the plot to the graph
34$graph->Add($lineplot);
35
36// Create the second data series
37$lineplot2=new LinePlot($ydata2);
38$lineplot2->SetWeight( 2 );   // Two pixel wide
39
40// Add the second plot to the graph
41$graph->Add($lineplot2);
42
43// Display the graph
44$graph->Stroke();
45?>
Note: See TracBrowser for help on using the repository browser.