source: trunk/xgraph/jpgraph/Examples/new_line1.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_line.php');
4
5$datay1 = array(20,15,23,15);
6$datay2 = array(12,9,42,8);
7$datay3 = array(5,17,32,24);
8
9// Setup the graph
10$graph = new Graph(300,250);
11$graph->SetScale("textlin");
12
13$theme_class=new UniversalTheme;
14
15$graph->SetTheme($theme_class);
16$graph->img->SetAntiAliasing(false);
17$graph->title->Set('Filled Y-grid');
18$graph->SetBox(false);
19
20$graph->img->SetAntiAliasing();
21
22$graph->yaxis->HideZeroLabel();
23$graph->yaxis->HideLine(false);
24$graph->yaxis->HideTicks(false,false);
25
26$graph->xgrid->Show();
27$graph->xgrid->SetLineStyle("solid");
28$graph->xaxis->SetTickLabels(array('A','B','C','D'));
29$graph->xgrid->SetColor('#E3E3E3');
30/* $graph->SetBackgroundImage("tiger_bkg.png",BGIMG_FILLPLOT); */
31
32// Create the first line
33$p1 = new LinePlot($datay1);
34$graph->Add($p1);
35$p1->SetColor("#6495ED");
36$p1->SetLegend('Line 1');
37
38// Create the second line
39$p2 = new LinePlot($datay2);
40$graph->Add($p2);
41$p2->SetColor("#B22222");
42$p2->SetLegend('Line 2');
43
44// Create the third line
45$p3 = new LinePlot($datay3);
46$graph->Add($p3);
47$p3->SetColor("#FF1493");
48$p3->SetLegend('Line 3');
49
50$graph->legend->SetFrameWeight(1);
51
52// Output line
53$graph->Stroke();
54
55?>
56
57
Note: See TracBrowser for help on using the repository browser.