[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 | '45.9' => array(3,2,1,2,2), |
---|
| 9 | 355 => array(1,1,1.5,2), |
---|
| 10 | 180 => array(1,1,1.5,2), |
---|
| 11 | 150 => array(1,2,1,3), |
---|
| 12 | 'S' => array(2,3,5,1), |
---|
| 13 | ); |
---|
| 14 | |
---|
| 15 | // Add some labels for afew of the directions |
---|
| 16 | $labels = array(355=>"At\nHome base",180=>"Probe\n123",150=>"Power\nplant"); |
---|
| 17 | |
---|
| 18 | // Define the color,weight and style of some individual radial grid lines. |
---|
| 19 | $axiscolors = array(355=>"red"); |
---|
| 20 | $axisweights = array(355=>8); |
---|
| 21 | $axisstyles = array(355=>'solid',150=>'solid'); |
---|
| 22 | |
---|
| 23 | // First create a new windrose graph with a title |
---|
| 24 | $graph = new WindroseGraph(400,500); |
---|
| 25 | $graph->title->Set('Windrose example 8'); |
---|
| 26 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,14); |
---|
| 27 | $graph->title->SetColor('navy'); |
---|
| 28 | |
---|
| 29 | // Create the free windrose plot. |
---|
| 30 | $wp = new WindrosePlot($data); |
---|
| 31 | $wp->SetType(WINDROSE_TYPEFREE); |
---|
| 32 | |
---|
| 33 | // Specify colors weights and style for the radial gridlines |
---|
| 34 | $wp->SetRadialColors($axiscolors); |
---|
| 35 | $wp->SetRadialWeights($axisweights); |
---|
| 36 | $wp->SetRadialStyles($axisstyles); |
---|
| 37 | |
---|
| 38 | // Add a few labels |
---|
| 39 | $wp->SetLabels($labels); |
---|
| 40 | |
---|
| 41 | // Add some "arbitrary" text to the center |
---|
| 42 | $wp->scale->SetZeroLabel("SOx\n8%%"); |
---|
| 43 | |
---|
| 44 | // Finally add it to the graph and send back to client |
---|
| 45 | $graph->Add($wp); |
---|
| 46 | $graph->Stroke(); |
---|
| 47 | ?> |
---|
| 48 | |
---|