| 1 |
lars |
1 |
<?php
|
|
|
2 |
include ("../jpgraph.php");
|
|
|
3 |
include ("../jpgraph_line.php");
|
|
|
4 |
|
|
|
5 |
$datay1 = array(2,6,7,12,13,18);
|
|
|
6 |
$datay2 = array(5,12,12,19,25,20);
|
|
|
7 |
|
|
|
8 |
// Setup the graph
|
|
|
9 |
$graph = new Graph(350,200);
|
|
|
10 |
$graph->SetMargin(30,20,60,20);
|
|
|
11 |
$graph->SetMarginColor('white');
|
|
|
12 |
$graph->SetScale("linlin");
|
|
|
13 |
|
|
|
14 |
// Hide the frame around the graph
|
|
|
15 |
$graph->SetFrame(false);
|
|
|
16 |
|
|
|
17 |
// Setup title
|
|
|
18 |
$graph->title->Set("Using Builtin PlotMarks");
|
|
|
19 |
$graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
|
|
|
20 |
|
|
|
21 |
// Note: requires jpgraph 1.12p or higher
|
|
|
22 |
// $graph->SetBackgroundGradient('blue','navy:0.5',GRAD_HOR,BGRAD_PLOT);
|
|
|
23 |
$graph->tabtitle->Set('Region 1' );
|
|
|
24 |
$graph->tabtitle->SetWidth(TABTITLE_WIDTHFULL);
|
|
|
25 |
|
|
|
26 |
// Enable X and Y Grid
|
|
|
27 |
$graph->xgrid->Show();
|
|
|
28 |
$graph->xgrid->SetColor('gray@0.5');
|
|
|
29 |
$graph->ygrid->SetColor('gray@0.5');
|
|
|
30 |
|
|
|
31 |
// Format the legend box
|
|
|
32 |
$graph->legend->SetColor('navy');
|
|
|
33 |
$graph->legend->SetFillColor('lightgreen');
|
|
|
34 |
$graph->legend->SetLineWeight(1);
|
|
|
35 |
$graph->legend->SetFont(FF_ARIAL,FS_BOLD,8);
|
|
|
36 |
$graph->legend->SetShadow('gray@0.4',3);
|
|
|
37 |
$graph->legend->SetAbsPos(15,120,'right','bottom');
|
|
|
38 |
|
|
|
39 |
// Create the line plots
|
|
|
40 |
|
|
|
41 |
$p1 = new LinePlot($datay1);
|
|
|
42 |
$p1->SetColor("red");
|
|
|
43 |
$p1->SetFillColor("yellow@0.5");
|
|
|
44 |
$p1->SetWeight(2);
|
|
|
45 |
$p1->mark->SetType(MARK_IMG_DIAMOND,5,0.6);
|
|
|
46 |
$p1->SetLegend('2006');
|
|
|
47 |
$graph->Add($p1);
|
|
|
48 |
|
|
|
49 |
$p2 = new LinePlot($datay2);
|
|
|
50 |
$p2->SetColor("darkgreen");
|
|
|
51 |
$p2->SetWeight(2);
|
|
|
52 |
$p2->SetLegend('2001');
|
|
|
53 |
$p2->mark->SetType(MARK_IMG_MBALL,'red');
|
|
|
54 |
$graph->Add($p2);
|
|
|
55 |
|
|
|
56 |
// Add a vertical line at the end scale position '7'
|
|
|
57 |
$l1 = new PlotLine(VERTICAL,7);
|
|
|
58 |
$graph->Add($l1);
|
|
|
59 |
|
|
|
60 |
// Output the graph
|
|
|
61 |
$graph->Stroke();
|
|
|
62 |
|
|
|
63 |
?>
|
|
|
64 |
|
|
|
65 |
|