[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 | $data = array(0,1,10,2,30,25,40,60, |
---|
| 8 | 50,110,60,160,70,210,75,230,80,260,85,370, |
---|
| 9 | 90,480, |
---|
| 10 | 95,370,100,260,105,230, |
---|
| 11 | 110,210,120,160,130,110,140,60, |
---|
| 12 | 150,25,170,2,180,1); |
---|
| 13 | |
---|
| 14 | $graph = new PolarGraph(350,320); |
---|
| 15 | $graph->SetScale('log',100); |
---|
| 16 | $graph->SetType(POLAR_180); |
---|
| 17 | |
---|
| 18 | // Hide frame around graph (by setting width=0) |
---|
| 19 | $graph->SetFrame(true,'white',1); |
---|
| 20 | |
---|
| 21 | // Show both major and minor grid lines |
---|
| 22 | $graph->axis->ShowGrid(true,true); |
---|
| 23 | |
---|
| 24 | // Set color for gradient lines |
---|
| 25 | $graph->axis->SetGridColor('lightblue:0.9','lightblue:0.9','lightblue:0.9'); |
---|
| 26 | |
---|
| 27 | // Set label and axis colors |
---|
| 28 | $graph->axis->SetColor('black','navy','darkred'); |
---|
| 29 | |
---|
| 30 | // Draw the ticks on the bottom side of the radius axis |
---|
| 31 | $graph->axis->SetTickSide(SIDE_DOWN); |
---|
| 32 | |
---|
| 33 | // Increase the margin for the labels since we changed the |
---|
| 34 | // side of the ticks. |
---|
| 35 | $graph->axis->SetLabelMargin(6); |
---|
| 36 | |
---|
| 37 | // Change fonts |
---|
| 38 | $graph->axis->SetFont(FF_ARIAL,FS_NORMAL,8); |
---|
| 39 | $graph->axis->SetAngleFont(FF_ARIAL,FS_NORMAL,8); |
---|
| 40 | |
---|
| 41 | // Setup axis title |
---|
| 42 | $graph->axis->SetTitle('Coverage (in meter)','middle'); |
---|
| 43 | $graph->axis->title->SetFont(FF_FONT1,FS_BOLD); |
---|
| 44 | |
---|
| 45 | // Setup graph title |
---|
| 46 | $graph->title->Set('Polar plot #9'); |
---|
| 47 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,16); |
---|
| 48 | $graph->title->SetColor('navy'); |
---|
| 49 | |
---|
| 50 | // Setup tab title |
---|
| 51 | $graph->tabtitle->Set('Microphone #1'); |
---|
| 52 | $graph->tabtitle->SetColor('brown:0.5','lightyellow'); |
---|
| 53 | |
---|
| 54 | |
---|
| 55 | $p = new PolarPlot($data); |
---|
| 56 | $p->SetFillColor('lightblue@0.5'); |
---|
| 57 | $p->mark->SetType(MARK_SQUARE); |
---|
| 58 | |
---|
| 59 | $graph->Add($p); |
---|
| 60 | |
---|
| 61 | $graph->Stroke(); |
---|
| 62 | |
---|
| 63 | ?> |
---|