1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_line.php'); |
---|
4 | |
---|
5 | $ydata = array(11,3,8,12,5,1,9,15,5,7); |
---|
6 | |
---|
7 | // Create the graph. These two calls are always required |
---|
8 | $graph = new Graph(300,200); |
---|
9 | $graph->SetScale("textlin"); |
---|
10 | $graph->yaxis->scale->SetGrace(10,10); |
---|
11 | |
---|
12 | // Create the linear plot |
---|
13 | $lineplot=new LinePlot($ydata); |
---|
14 | $lineplot->mark->SetType(MARK_CIRCLE); |
---|
15 | |
---|
16 | // Add the plot to the graph |
---|
17 | $graph->Add($lineplot); |
---|
18 | |
---|
19 | $graph->img->SetMargin(40,20,20,40); |
---|
20 | $graph->title->Set("Grace value, version 1"); |
---|
21 | $graph->xaxis->title->Set("X-title"); |
---|
22 | $graph->yaxis->title->Set("Y-title"); |
---|
23 | |
---|
24 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
25 | $graph->yaxis->title->SetFont(FF_FONT1,FS_BOLD); |
---|
26 | $graph->xaxis->title->SetFont(FF_FONT1,FS_BOLD); |
---|
27 | |
---|
28 | $lineplot->SetColor("blue"); |
---|
29 | $lineplot->SetWeight(2); |
---|
30 | $graph->yaxis->SetWeight(2); |
---|
31 | $graph->SetShadow(); |
---|
32 | |
---|
33 | // Display the graph |
---|
34 | $graph->Stroke(); |
---|
35 | ?> |
---|