[42] | 1 | <?php // content="text/plain; charset=utf-8" |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_log.php'); |
---|
| 4 | require_once ('jpgraph/jpgraph_radar.php'); |
---|
| 5 | |
---|
| 6 | // Some data to plot |
---|
| 7 | $data = array(242,58,1500,12,1397,810,373); |
---|
| 8 | $data2 = array(447,176,1472,191,1616,42,46); |
---|
| 9 | |
---|
| 10 | // Create the graph |
---|
| 11 | $graph = new RadarGraph(300,350); |
---|
| 12 | |
---|
| 13 | // Use logarithmic scale (If you don't use any SetScale() |
---|
| 14 | // the radar graph will default to linear scale |
---|
| 15 | $graph->SetScale('log'); |
---|
| 16 | |
---|
| 17 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,16); |
---|
| 18 | $graph->title->Set('Logarithmic scale'); |
---|
| 19 | $graph->title->SetMargin(10); |
---|
| 20 | |
---|
| 21 | // Make the radar graph fill out it's bounding box |
---|
| 22 | $graph->SetPlotSize(0.8); |
---|
| 23 | $graph->SetCenter(0.5,0.55); |
---|
| 24 | |
---|
| 25 | // Note: Enabling this results in a very noticable slow |
---|
| 26 | // down of the image generation! And more load on your |
---|
| 27 | // server. |
---|
| 28 | $graph->img->SetAntiAliasing(); |
---|
| 29 | |
---|
| 30 | // Uncomment the following line if you want to supress |
---|
| 31 | // minor tick marks |
---|
| 32 | //$graph->yscale->ticks->SupressMinorTickMarks(); |
---|
| 33 | |
---|
| 34 | // We want the major tick marks to be black and minor |
---|
| 35 | // slightly less noticable |
---|
| 36 | $graph->yscale->ticks->SetMarkColor('black','darkgray'); |
---|
| 37 | |
---|
| 38 | // Set the axis title font |
---|
| 39 | $graph->axis->title->SetFont(FF_ARIAL,FS_BOLD,14); |
---|
| 40 | $graph->axis->title->SetColor('darkred:0.8'); |
---|
| 41 | |
---|
| 42 | // Use blue axis |
---|
| 43 | $graph->axis->SetColor('blue'); |
---|
| 44 | |
---|
| 45 | $plot = new RadarPlot($data); |
---|
| 46 | $plot->SetLineWeight(1); |
---|
| 47 | $plot->SetColor('forestgreen'); |
---|
| 48 | $plot->SetFillColor('forestgreen@0.9'); |
---|
| 49 | |
---|
| 50 | $plot2 = new RadarPlot($data2); |
---|
| 51 | $plot2->SetLineWeight(2); |
---|
| 52 | $plot2->SetColor('red'); |
---|
| 53 | $plot2->SetFillColor('red@0.9'); |
---|
| 54 | |
---|
| 55 | // Add the plot and display the graph |
---|
| 56 | $graph->Add($plot); |
---|
| 57 | $graph->Add($plot2); |
---|
| 58 | $graph->Stroke(); |
---|
| 59 | ?> |
---|
| 60 | |
---|