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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.3 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_log.php');
4require_once ('jpgraph/jpgraph_line.php');
5
6$ydata = array(11,3,8,12,5,1,9,13,5,7);
7$y2data = array(354,200,265,99,111,91,198,225,293,251);
8
9// Create the graph. These two calls are always required
10$graph = new Graph(350,200);   
11$graph->SetScale("textlog");
12$graph->SetShadow();
13$graph->img->SetMargin(40,110,20,40);
14
15// Show the gridlines
16$graph->ygrid->Show(true,true);
17$graph->xgrid->Show(true,false);
18
19// Create the linear plot
20$lineplot=new LinePlot($ydata);
21$lineplot2=new LinePlot($y2data);
22
23// Add the plot to the graph
24$graph->Add($lineplot);
25
26$graph->title->Set("Example 8");
27$graph->xaxis->title->Set("X-title");
28$graph->yaxis->title->Set("Y-title");
29
30$graph->title->SetFont(FF_FONT1,FS_BOLD);
31$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
32$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
33
34$lineplot->SetColor("blue");
35$lineplot->SetWeight(2);
36
37// Adjust the color of the Y axis
38$graph->yaxis->SetColor("blue");
39
40// Specifya a legend
41$lineplot->SetLegend("Plot 1");
42
43// Adjust the position of the grid box
44$graph->legend->Pos(0.05,0.5,"right","center");
45
46// Display the graph
47$graph->Stroke();
48?>
Note: See TracBrowser for help on using the repository browser.