[42] | 1 | <?php // content="text/plain; charset=utf-8"
|
---|
| 2 | // A simple Polar graph,
|
---|
| 3 |
|
---|
| 4 | require_once ('jpgraph/jpgraph.php');
|
---|
| 5 | require_once ('jpgraph/jpgraph_polar.php');
|
---|
| 6 |
|
---|
| 7 |
|
---|
| 8 | $data = array(0,1,30,2,30,25,40,60,
|
---|
| 9 | 50,110,60,160,70,210,75,230,80,260,85,370,
|
---|
| 10 | 90,480,
|
---|
| 11 | 95,370,100,260,105,230,
|
---|
| 12 | 110,210,120,160,130,110,140,60,
|
---|
| 13 | 150,25,150,2,180,1);
|
---|
| 14 |
|
---|
| 15 | $n = count($data);
|
---|
| 16 | for($i=0; $i < $n; $i+=2 ) {
|
---|
| 17 | $data[$n+$i] = 360-$data[$i];
|
---|
| 18 | $data[$n+$i+1] = $data[$i+1];
|
---|
| 19 | }
|
---|
| 20 |
|
---|
| 21 |
|
---|
| 22 | $graph = new PolarGraph(300,400);
|
---|
| 23 | $graph->SetScale('log',100);
|
---|
| 24 | $graph->SetType(POLAR_360);
|
---|
| 25 | $graph->SetPlotSize(220,300);
|
---|
| 26 |
|
---|
| 27 | // Hide frame around graph (by setting width=0)
|
---|
| 28 | $graph->SetFrame(true,'white',1);
|
---|
| 29 |
|
---|
| 30 | $graph->SetBackgroundGradient('blue:1.3','brown:1.4',GRAD_MIDHOR,BGRAD_PLOT);
|
---|
| 31 |
|
---|
| 32 | // Set color for gradient lines
|
---|
| 33 | $graph->axis->SetGridColor('gray','gray','gray');
|
---|
| 34 |
|
---|
| 35 | $graph->title->Set('Polar plot #7-2');
|
---|
| 36 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,16);
|
---|
| 37 | $graph->title->SetColor('navy');
|
---|
| 38 |
|
---|
| 39 | // Adjust legen box position and color
|
---|
| 40 | $graph->legend->SetColor('navy','darkgray');
|
---|
| 41 | $graph->legend->SetFillColor('white');
|
---|
| 42 | $graph->legend->SetShadow('darkgray@0.5',5);
|
---|
| 43 |
|
---|
| 44 | $p = new PolarPlot($data);
|
---|
| 45 | $p->SetFillColor('yellow@0.6');
|
---|
| 46 | $p->mark->SetType(MARK_SQUARE);
|
---|
| 47 | $p->SetLegend("Mirophone #1\n(No amps)");
|
---|
| 48 |
|
---|
| 49 | $graph->Add($p);
|
---|
| 50 |
|
---|
| 51 | $graph->Stroke();
|
---|
| 52 |
|
---|
| 53 | ?>
|
---|