Rev | Line | |
---|
[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_scatter.php'); |
---|
| 4 | |
---|
| 5 | // Make a circle with a scatterplot |
---|
| 6 | $steps=16; |
---|
| 7 | for($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.