Line | |
---|
1 | <?php // content="text/plain; charset=utf-8" |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_scatter.php'); |
---|
4 | |
---|
5 | |
---|
6 | // Make a circle with a scatterplot |
---|
7 | $steps=16; |
---|
8 | for($i=0; $i<$steps; ++$i) { |
---|
9 | $a=2*M_PI/$steps*$i; |
---|
10 | $datax[$i]=cos($a); |
---|
11 | $datay[$i]=sin($a); |
---|
12 | } |
---|
13 | |
---|
14 | |
---|
15 | $graph = new Graph(300,200); |
---|
16 | $graph->SetScale("linlin"); |
---|
17 | |
---|
18 | $graph->img->SetMargin(40,40,40,40); |
---|
19 | |
---|
20 | $graph->SetShadow(); |
---|
21 | $graph->title->Set("Linked scatter plot"); |
---|
22 | $graph->title->SetFont(FF_FONT1,FS_BOLD); |
---|
23 | |
---|
24 | // 10% top and bottom grace |
---|
25 | $graph->yscale->SetGrace(5,5); |
---|
26 | $graph->xscale->SetGrace(1,1); |
---|
27 | |
---|
28 | $sp1 = new ScatterPlot($datay,$datax); |
---|
29 | $sp1->mark->SetType(MARK_FILLEDCIRCLE); |
---|
30 | $sp1->mark->SetFillColor("red"); |
---|
31 | $sp1->SetColor("blue"); |
---|
32 | |
---|
33 | //$sp1->SetWeight(3); |
---|
34 | $sp1->mark->SetWidth(4); |
---|
35 | $sp1->SetLinkPoints(); |
---|
36 | |
---|
37 | $graph->Add($sp1); |
---|
38 | |
---|
39 | $graph->Stroke(); |
---|
40 | |
---|
41 | ?> |
---|
42 | |
---|
43 | |
---|
Note: See
TracBrowser
for help on using the repository browser.