source: trunk/xgraph/jpgraph/Examples/example9.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_log.php');
4require_once ('jpgraph/jpgraph_line.php');
5
6
7$ydata = array(11,3,8,42,5,1,9,13,5,7);
8$datax = array("Jan","Feb","Mar","Apr","Maj","Jun","Jul","aug","Sep","Oct");
9
10// Create the graph. These two calls are always required
11$graph = new Graph(350,200);
12$graph->SetScale("textlog");
13
14$graph->img->SetMargin(40,110,20,40);
15$graph->SetShadow();
16
17$graph->ygrid->Show(true,true);
18$graph->xgrid->Show(true,false);
19
20// Specify the tick labels
21$a = $gDateLocale->GetShortMonth();
22$graph->xaxis->SetTickLabels($a);
23
24// Create the linear plot
25$lineplot=new LinePlot($ydata);
26
27// Add the plot to the graph
28$graph->Add($lineplot);
29
30$graph->title->Set("Examples 9");
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$graph->yaxis->SetColor("blue");
42
43$lineplot->SetLegend("Plot 1");
44
45$graph->legend->Pos(0.05,0.5,"right","center");
46
47// Display the graph
48$graph->Stroke();
49?>
Note: See TracBrowser for help on using the repository browser.