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

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.8 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_line.php');
4
5$datay1 = array(4,26,12,18,8,22);
6$datay2 = array(12,9,42,8,20,19);
7
8// Setup the graph
9$graph = new Graph(300,200);
10$graph->SetMarginColor('white');
11$graph->SetScale("textlin",0,50);
12$graph->SetMargin(30,50,30,30);
13
14// We must have the frame enabled to get the gradient
15// However, we don't want the frame line so we set it to
16// white color which makes it invisible.
17$graph->SetFrame(true,'white');
18
19// Setup a background gradient image
20$graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_PLOT);
21
22// Setup the tab title
23$graph->tabtitle->Set(' 3rd Division ' );
24$graph->tabtitle->SetFont(FF_ARIAL,FS_BOLD,13);
25
26// Setup x,Y grid
27$graph->xgrid->Show();
28$graph->xgrid->SetColor('gray@0.5');
29$graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth());
30$graph->ygrid->SetColor('gray@0.5');
31
32// Setup color for axis and labels on axis
33$graph->xaxis->SetColor('orange','black');
34$graph->yaxis->SetColor('orange','black');
35
36// Ticks on the outsid
37$graph->xaxis->SetTickSide(SIDE_DOWN);
38$graph->yaxis->SetTickSide(SIDE_LEFT);
39
40// Setup the legend box colors and font
41$graph->legend->SetColor('white','navy');
42$graph->legend->SetFillColor('navy@0.25');
43$graph->legend->SetFont(FF_ARIAL,FS_BOLD,8);
44$graph->legend->SetShadow('darkgray@0.4',3);
45$graph->legend->SetPos(0.05,0.05,'right','top');
46
47// Create the first line
48$p1 = new LinePlot($datay1);
49$p1->SetColor("red");
50$p1->SetWeight(2);
51$p1->SetLegend('2002');
52$graph->Add($p1);
53
54// Create the second line
55$p2 = new LinePlot($datay2);
56$p2->SetColor("lightyellow");
57$p2->SetLegend('2001');
58$p2->SetWeight(2);
59$graph->Add($p2);
60
61// Output line
62$graph->Stroke();
63
64?>
65
66
Note: See TracBrowser for help on using the repository browser.