Rev | Line | |
---|
[42] | 1 | <?php |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_windrose.php'); |
---|
| 4 | |
---|
| 5 | // Some data for the five windrose plots |
---|
| 6 | $data = array( |
---|
| 7 | array( |
---|
| 8 | 1 => array(10,10,13,7), |
---|
| 9 | 2 => array(2,8,10), |
---|
| 10 | 4 => array(1,12,22)), |
---|
| 11 | array( |
---|
| 12 | 4 => array(12,8,2,3), |
---|
| 13 | 2 => array(5,4,4,5,2)), |
---|
| 14 | array( |
---|
| 15 | 1 => array(12,8,2,3), |
---|
| 16 | 3 => array(5,4,4,5,2)), |
---|
| 17 | array( |
---|
| 18 | 2 => array(12,8,2,3), |
---|
| 19 | 3 => array(5,4,4,5,2)), |
---|
| 20 | array( |
---|
| 21 | 4 => array(12,8,2,3), |
---|
| 22 | 6 => array(5,4,4,5,2)) |
---|
| 23 | ); |
---|
| 24 | |
---|
| 25 | // Legend range colors |
---|
| 26 | $rangecolors = array('green','yellow','red','brown'); |
---|
| 27 | |
---|
| 28 | // Create a windrose graph with titles |
---|
| 29 | $graph = new WindroseGraph(750,700); |
---|
| 30 | |
---|
| 31 | $graph->title->Set('Multiple plots with automatic layout'); |
---|
| 32 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,14); |
---|
| 33 | |
---|
| 34 | // Setup the individual windrose plots |
---|
| 35 | $wp = array(); |
---|
| 36 | for( $i=0; $i < 5; ++$i ) { |
---|
| 37 | $wp[$i] = new WindrosePlot($data[$i]); |
---|
| 38 | $wp[$i]->SetType(WINDROSE_TYPE8); |
---|
| 39 | if( $i < 2) { |
---|
| 40 | $wp[$i]->SetSize(0.28); |
---|
| 41 | } |
---|
| 42 | else { |
---|
| 43 | $wp[$i]->legend->Hide(); |
---|
| 44 | $wp[$i]->SetSize(0.16); |
---|
| 45 | $wp[$i]->SetCenterSize(0.25); |
---|
| 46 | } |
---|
| 47 | $wp[$i]->SetRangeColors($rangecolors); |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | // Position with two rows. Two plots in top row and three plots in |
---|
| 51 | // bottom row. |
---|
| 52 | $hl1 = new LayoutHor( array( $wp[0], $wp[1] ) ); |
---|
| 53 | $hl2 = new LayoutHor( array( $wp[2], $wp[3], $wp[4] ) ); |
---|
| 54 | $vl = new LayoutVert( array( $hl1, $hl2) ); |
---|
| 55 | |
---|
| 56 | $graph->Add($vl); |
---|
| 57 | $graph->Stroke(); |
---|
| 58 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.