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

Last change on this file since 42 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$ydata = array(11,3,8,12,5,1,9,13,5,7);
6$ydata2 = array(1,19,15,7,22,14,5,9,21,13);
7
8$timer = new JpgTimer();
9$timer->Push();
10
11// Create the graph. These two calls are always required
12$graph = new Graph(300,200);
13$graph->SetScale("textlin");
14
15$graph->SetMargin(40,20,20,60);
16
17$graph->title->Set("Timing a graph");
18$graph->footer->right->Set('Timer (ms): ');
19$graph->footer->right->SetFont(FF_COURIER,FS_ITALIC);
20$graph->footer->SetTimer($timer);
21
22// Create the linear plot
23$lineplot=new LinePlot($ydata);
24
25$lineplot2=new LinePlot($ydata2);
26
27// Add the plot to the graph
28$graph->Add($lineplot);
29$graph->Add($lineplot2);
30
31$graph->xaxis->title->Set("X-title");
32$graph->yaxis->title->Set("Y-title");
33
34$graph->title->SetFont(FF_FONT1,FS_BOLD);
35$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
36$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
37
38$lineplot->SetColor("blue");
39$lineplot->SetWeight(2);
40
41$lineplot2->SetColor("orange");
42$lineplot2->SetWeight(2);
43
44$graph->yaxis->SetColor("red");
45$graph->yaxis->SetWeight(2);
46$graph->SetShadow();
47
48// Display the graph
49$graph->Stroke();
50?>
Note: See TracBrowser for help on using the repository browser.