1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
4 | |
---|
5 | // Some data |
---|
6 | $ydata = array(11,3,8,12,5,1,9,13,5,7); |
---|
7 | |
---|
8 | // Create the graph. These two calls are always required |
---|
9 | $graph = new Graph(350,250); |
---|
10 | $graph->SetScale("textlin"); |
---|
11 | $graph->SetMargin(40,40,50,50); |
---|
12 | |
---|
13 | // Setup the grid and plotarea box |
---|
14 | $graph->ygrid->SetLineStyle('dashed'); |
---|
15 | $graph->ygrid->setColor('darkgray'); |
---|
16 | $graph->SetBox(true); |
---|
17 | |
---|
18 | // Steup graph titles |
---|
19 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,12); |
---|
20 | $graph->title->Set('Using background image'); |
---|
21 | $graph->subtitle->SetFont(FF_COURIER,FS_BOLD,11); |
---|
22 | $graph->subtitle->Set('"BGIMG_COPY"'); |
---|
23 | $graph->subtitle->SetColor('darkred'); |
---|
24 | |
---|
25 | // Add background with 25% mix |
---|
26 | $graph->SetBackgroundImage('heat1.jpg',BGIMG_COPY); |
---|
27 | $graph->SetBackgroundImageMix(25); |
---|
28 | |
---|
29 | // Create the linear plot |
---|
30 | $lineplot=new LinePlot($ydata); |
---|
31 | $lineplot->SetColor("blue"); |
---|
32 | |
---|
33 | // Add the plot to the graph |
---|
34 | $graph->Add($lineplot); |
---|
35 | |
---|
36 | // Display the graph |
---|
37 | $graph->Stroke(); |
---|
38 | ?> |
---|