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