[42] | 1 | <?php
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_windrose.php');
|
---|
| 4 |
|
---|
| 5 | $data = array(
|
---|
| 6 | 2 => array(1,15,7.5,2),
|
---|
| 7 | 5 => array(1,1,1.5,2),
|
---|
| 8 | 7 => array(1,2,10,3,2),
|
---|
| 9 | 9 => array(2,3,1,3,1,2),
|
---|
| 10 | );
|
---|
| 11 |
|
---|
| 12 | // First create a new windrose graph with a title
|
---|
| 13 | $graph = new WindroseGraph(400,450);
|
---|
| 14 | $graph->title->Set('Windrose example 7');
|
---|
| 15 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
|
---|
| 16 | $graph->title->SetColor('navy');
|
---|
| 17 |
|
---|
| 18 | // Create the free windrose plot.
|
---|
| 19 | $wp = new WindrosePlot($data);
|
---|
| 20 | $wp->SetType(WINDROSE_TYPE16);
|
---|
| 21 |
|
---|
| 22 | // Add some "arbitrary" text to the center
|
---|
| 23 | $wp->scale->SetZeroLabel("SOx\n8%%");
|
---|
| 24 |
|
---|
| 25 | // Localize the compass direction labels into Swedish
|
---|
| 26 | // Note: The labels for data must now also match the exact
|
---|
| 27 | // string for the compass directions.
|
---|
| 28 | $se_CompassLbl = array('O','ONO','NO','NNO','N','NNV','NV','VNV',
|
---|
| 29 | 'V','VSV','SV','SSV','S','SSO','SO','OSO');
|
---|
| 30 | $wp->SetCompassLabels($se_CompassLbl);
|
---|
| 31 |
|
---|
| 32 | // Localize the "Calm" text into Swedish and make the circle
|
---|
| 33 | // slightly bigger than default
|
---|
| 34 | $se_calmtext = 'Lugnt';
|
---|
| 35 | $wp->legend->SetCircleText($se_calmtext);
|
---|
| 36 | $wp->legend->SetCircleRadius(20);
|
---|
| 37 |
|
---|
| 38 | // Adjust the displayed ranges
|
---|
| 39 | $ranges = array(1,3,5,8,12,19,29);
|
---|
| 40 | $wp->SetRanges($ranges);
|
---|
| 41 | //$wp->SetAntiAlias(true);
|
---|
| 42 |
|
---|
| 43 | // Set the scale to always have max value of 30 with a step
|
---|
| 44 | // size of 12.
|
---|
| 45 | $wp->scale->Set(30,12);
|
---|
| 46 |
|
---|
| 47 | // Finally add it to the graph and send back to client
|
---|
| 48 | $graph->Add($wp);
|
---|
| 49 | $graph->Stroke();
|
---|
| 50 | ?>
|
---|
| 51 |
|
---|