| 1 |
lars |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
include("../jpgraph.php");
|
|
|
4 |
include("../jpgraph_line.php");
|
|
|
5 |
|
|
|
6 |
// Some data
|
|
|
7 |
$ydata = array(5,10,15,20,15,10,8,7,4,10,5);
|
|
|
8 |
|
|
|
9 |
// Create the graph
|
|
|
10 |
$graph= new Graph(400,300,"auto");
|
|
|
11 |
$graph->SetScale("textlin");
|
|
|
12 |
$graph->SetShadow(true);
|
|
|
13 |
$graph->SetMarginColor("lightblue");
|
|
|
14 |
|
|
|
15 |
// Setup format for legend
|
|
|
16 |
$graph->legend->SetFillColor("antiquewhite");
|
|
|
17 |
$graph->legend->SetShadow(true);
|
|
|
18 |
|
|
|
19 |
// Setup title
|
|
|
20 |
$graph->title->Set("Filled Area Example");
|
|
|
21 |
$graph->title->SetFont(FF_FONT2,FS_BOLD);
|
|
|
22 |
|
|
|
23 |
// Setup semi-filled line plot
|
|
|
24 |
$lineplot = new LinePlot($ydata);
|
|
|
25 |
$lineplot->SetLegend("Semi-filled\nLineplot");
|
|
|
26 |
|
|
|
27 |
// Set line color
|
|
|
28 |
$lineplot->SetColor("black");
|
|
|
29 |
|
|
|
30 |
// Setup the two areas to be filled
|
|
|
31 |
$lineplot->AddArea(2,5,LP_AREA_FILLED,"red");
|
|
|
32 |
$lineplot->AddArea(6,8,LP_AREA_FILLED,"green");
|
|
|
33 |
|
|
|
34 |
// Display the marks on the lines
|
|
|
35 |
$lineplot->mark->SetType(MARK_DIAMOND);
|
|
|
36 |
$lineplot->mark->SetSize(8);
|
|
|
37 |
$lineplot->mark->Show();
|
|
|
38 |
|
|
|
39 |
// add plot to the graph
|
|
|
40 |
$graph->Add($lineplot);
|
|
|
41 |
|
|
|
42 |
// display graph
|
|
|
43 |
$graph->Stroke();
|
|
|
44 |
?>
|