source: trunk/xgraph/jpgraph/Examples/scatterlinkex4.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.0 KB
Line 
1<?php // content="text/plain; charset=utf-8"
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_scatter.php');
4
5// Make a circle with a scatterplot
6$steps=16;
7for($i=0; $i<$steps; ++$i) {
8        $a=2*M_PI/$steps*$i;
9        $datax[$i]=cos($a);
10        $datay[$i]=sin($a);
11}
12
13$graph = new Graph(350,230);
14$graph->SetScale('linlin');
15$graph->SetShadow();
16$graph->SetAxisStyle(AXSTYLE_BOXIN);
17
18$graph->img->SetMargin(50,50,60,40);
19
20$graph->title->Set('Linked scatter plot');
21$graph->title->SetFont(FF_FONT1,FS_BOLD);
22$graph->subtitle->Set('(BOXIN Axis style)');
23$graph->subtitle->SetFont(FF_FONT1,FS_NORMAL);
24
25// 10% top and bottom grace
26$graph->yscale->SetGrace(5,5);
27$graph->xscale->SetGrace(1,1);
28
29$sp1 = new ScatterPlot($datay,$datax);
30$sp1->mark->SetType(MARK_FILLEDCIRCLE);
31$sp1->mark->SetFillColor('red');
32$sp1->SetColor('blue');
33
34$sp1->mark->SetWidth(4);
35$sp1->link->Show();
36$sp1->link->SetWeight(2);
37$sp1->link->SetColor('red@0.7');
38
39
40$graph->Add($sp1);
41$graph->Stroke();
42
43?>
44
45
Note: See TracBrowser for help on using the repository browser.