Line | |
---|
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 | $datay = array(25,29,29,39,55); |
---|
7 | |
---|
8 | $graph = new Graph(400,200,'auto'); |
---|
9 | $graph->img->SetMargin(40,40,40,20); |
---|
10 | |
---|
11 | $graph->SetScale("linlin"); |
---|
12 | $graph->SetShadow(); |
---|
13 | $graph->title->Set("Top X-axis"); |
---|
14 | |
---|
15 | // Start at 0 |
---|
16 | $graph->yscale->SetAutoMin(0); |
---|
17 | |
---|
18 | // Add some air around the Y-scale |
---|
19 | $graph->yscale->SetGrace(100); |
---|
20 | |
---|
21 | // Use built in font |
---|
22 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
23 | |
---|
24 | // Adjust the X-axis |
---|
25 | $graph->xaxis->SetPos("max"); |
---|
26 | $graph->xaxis->SetLabelSide(SIDE_UP); |
---|
27 | $graph->xaxis->SetTickSide(SIDE_DOWN); |
---|
28 | |
---|
29 | // Create the line plot |
---|
30 | $p1 = new LinePlot($datay); |
---|
31 | $p1->SetColor("blue"); |
---|
32 | |
---|
33 | // Specify marks for the line plots |
---|
34 | $p1->mark->SetType(MARK_FILLEDCIRCLE); |
---|
35 | $p1->mark->SetFillColor("red"); |
---|
36 | $p1->mark->SetWidth(4); |
---|
37 | |
---|
38 | // Show values |
---|
39 | $p1->value->Show(); |
---|
40 | |
---|
41 | // Add lineplot to graph |
---|
42 | $graph->Add($p1); |
---|
43 | |
---|
44 | // Output line |
---|
45 | $graph->Stroke(); |
---|
46 | |
---|
47 | ?> |
---|
48 | |
---|
49 | |
---|
Note: See
TracBrowser
for help on using the repository browser.