[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,460);
|
---|
| 25 | $graph->title->Set('Adding label backgrounds');
|
---|
| 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 | $wp->scale->SetLabelFillColor('lightblue','black');
|
---|
| 33 |
|
---|
| 34 | // Specify colors weights and style for the radial gridlines
|
---|
| 35 | $wp->SetRadialColors($axiscolors);
|
---|
| 36 | $wp->SetRadialWeights($axisweights);
|
---|
| 37 | $wp->SetRadialStyles($axisstyles);
|
---|
| 38 |
|
---|
| 39 | // Add a few labels
|
---|
| 40 | $wp->SetLabels($labels);
|
---|
| 41 |
|
---|
| 42 | // Add some "arbitrary" text to the center
|
---|
| 43 | $wp->scale->SetZeroLabel("SOx\n8%%");
|
---|
| 44 |
|
---|
| 45 | // Finally add it to the graph and send back to client
|
---|
| 46 | $graph->Add($wp);
|
---|
| 47 | $graph->Stroke();
|
---|
| 48 | ?>
|
---|
| 49 |
|
---|