1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_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,200); |
---|
11 | $graph->SetMarginColor('white'); |
---|
12 | $graph->SetScale("textlin"); |
---|
13 | $graph->SetFrame(false); |
---|
14 | $graph->SetMargin(30,50,30,30); |
---|
15 | |
---|
16 | $graph->title->Set('Filled Y-grid'); |
---|
17 | |
---|
18 | |
---|
19 | $graph->yaxis->HideZeroLabel(); |
---|
20 | $graph->ygrid->SetFill(true,'#EFEFEF@0.5','#BBCCFF@0.5'); |
---|
21 | $graph->xgrid->Show(); |
---|
22 | |
---|
23 | $graph->xaxis->SetTickLabels($gDateLocale->GetShortMonth()); |
---|
24 | |
---|
25 | // Create the first line |
---|
26 | $p1 = new LinePlot($datay1); |
---|
27 | $p1->SetColor("navy"); |
---|
28 | $p1->SetLegend('Line 1'); |
---|
29 | $graph->Add($p1); |
---|
30 | |
---|
31 | // Create the second line |
---|
32 | $p2 = new LinePlot($datay2); |
---|
33 | $p2->SetColor("red"); |
---|
34 | $p2->SetLegend('Line 2'); |
---|
35 | $graph->Add($p2); |
---|
36 | |
---|
37 | // Create the third line |
---|
38 | $p3 = new LinePlot($datay3); |
---|
39 | $p3->SetColor("orange"); |
---|
40 | $p3->SetLegend('Line 3'); |
---|
41 | $graph->Add($p3); |
---|
42 | |
---|
43 | $graph->legend->SetShadow('gray@0.4',5); |
---|
44 | $graph->legend->SetPos(0.1,0.1,'right','top'); |
---|
45 | // Output line |
---|
46 | $graph->Stroke(); |
---|
47 | |
---|
48 | ?> |
---|
49 | |
---|
50 | |
---|