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 |
|
---|
| 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 | $graph = new Graph(350,230);
|
---|
| 15 | $graph->SetScale('linlin');
|
---|
| 16 | $graph->SetShadow();
|
---|
| 17 | $graph->SetAxisStyle(AXSTYLE_BOXOUT);
|
---|
| 18 |
|
---|
| 19 | $graph->img->SetMargin(50,50,60,40);
|
---|
| 20 |
|
---|
| 21 | $graph->title->Set('Linked scatter plot');
|
---|
| 22 | $graph->title->SetFont(FF_FONT1,FS_BOLD);
|
---|
| 23 | $graph->subtitle->Set('(BOXOUT Axis style)');
|
---|
| 24 | $graph->subtitle->SetFont(FF_FONT1,FS_NORMAL);
|
---|
| 25 |
|
---|
| 26 |
|
---|
| 27 | // 10% top and bottom grace
|
---|
| 28 | $graph->yscale->SetGrace(5,5);
|
---|
| 29 | $graph->xscale->SetGrace(1,1);
|
---|
| 30 |
|
---|
| 31 | $sp1 = new ScatterPlot($datay,$datax);
|
---|
| 32 | $sp1->mark->SetType(MARK_FILLEDCIRCLE);
|
---|
| 33 | $sp1->mark->SetFillColor('red');
|
---|
| 34 | $sp1->SetColor('blue');
|
---|
| 35 |
|
---|
| 36 | $sp1->mark->SetWidth(4);
|
---|
| 37 | $sp1->link->Show();
|
---|
| 38 | $sp1->link->SetStyle('dotted');
|
---|
| 39 |
|
---|
| 40 | $graph->Add($sp1);
|
---|
| 41 | $graph->Stroke();
|
---|
| 42 |
|
---|
| 43 | ?>
|
---|
| 44 |
|
---|
| 45 |
|
---|
Note:
See
TracBrowser
for help on using the repository browser.