[42] | 1 | <?php
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_windrose.php');
|
---|
| 4 |
|
---|
| 5 | // Data can be specified using both ordinal index of the axis
|
---|
| 6 | // as well as the direction label
|
---|
| 7 | $data = array(
|
---|
| 8 | 0 => array(1,1,6,4),
|
---|
| 9 | 1 => array(3,8,1,4),
|
---|
| 10 | 2 => array(2,7,4,4,3),
|
---|
| 11 | 3 => array(2,7,1,2));
|
---|
| 12 |
|
---|
| 13 | // First create a new windrose graph with a title
|
---|
| 14 | $graph = new WindroseGraph(400,400);
|
---|
| 15 |
|
---|
| 16 | // Setup title
|
---|
| 17 | $graph->title->Set('Windrose example 2');
|
---|
| 18 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
|
---|
| 19 | $graph->title->SetColor('navy');
|
---|
| 20 |
|
---|
| 21 | // Create the windrose plot.
|
---|
| 22 | $wp = new WindrosePlot($data);
|
---|
| 23 |
|
---|
| 24 | // Make it have 8 compass direction
|
---|
| 25 | $wp->SetType(WINDROSE_TYPE4);
|
---|
| 26 |
|
---|
| 27 | // Setup the weight of the laegs for the different ranges
|
---|
| 28 | $weights = array_fill(0,8,10);
|
---|
| 29 | $wp->SetRangeWeights($weights);
|
---|
| 30 |
|
---|
| 31 | // Adjust the font and font color for scale labels
|
---|
| 32 | $wp->scale->SetFont(FF_TIMES,FS_NORMAL,11);
|
---|
| 33 | $wp->scale->SetFontColor('navy');
|
---|
| 34 |
|
---|
| 35 | // Set the diametr for the plot to 160 pixels
|
---|
| 36 | $wp->SetSize(160);
|
---|
| 37 |
|
---|
| 38 | // Set the size of the innermost center circle to 30% of the plot size
|
---|
| 39 | $wp->SetZCircleSize(0.2);
|
---|
| 40 |
|
---|
| 41 | // Adjust the font and font color for compass directions
|
---|
| 42 | $wp->SetFont(FF_ARIAL,FS_NORMAL,12);
|
---|
| 43 | $wp->SetFontColor('darkgreen');
|
---|
| 44 |
|
---|
| 45 | // Add and send back to browser
|
---|
| 46 | $graph->Add($wp);
|
---|
| 47 | $graph->Stroke();
|
---|
| 48 | ?>
|
---|
| 49 |
|
---|