source: trunk/xgraph/jpgraph/Examples/example9.1.php

Last change on this file 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
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$graph->xaxis->SetTextLabelInterval(2);
24
25// Create the linear plot
26$lineplot=new LinePlot($ydata);
27
28// Add the plot to the graph
29$graph->Add($lineplot);
30
31$graph->title->Set("Examples 9");
32$graph->xaxis->title->Set("X-title");
33$graph->yaxis->title->Set("Y-title");
34
35$graph->title->SetFont(FF_FONT1,FS_BOLD);
36$graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD);
37$graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD);
38
39$lineplot->SetColor("blue");
40$lineplot->SetWeight(2);
41
42$graph->yaxis->SetColor("blue");
43
44$lineplot->SetLegend("Plot 1");
45
46$graph->legend->Pos(0.05,0.5,"right","center");
47
48// Display the graph
49$graph->Stroke();
50?>
Note: See TracBrowser for help on using the repository browser.