[42] | 1 | <?php
|
---|
| 2 | require_once ('jpgraph/jpgraph.php');
|
---|
| 3 | require_once ('jpgraph/jpgraph_windrose.php');
|
---|
| 4 |
|
---|
| 5 |
|
---|
| 6 |
|
---|
| 7 | // Data can be specified using both ordinal index of the axis
|
---|
| 8 | // as well as the direction label.
|
---|
| 9 | $data = array(
|
---|
| 10 | 2 => array(1,15,7.5,2),
|
---|
| 11 | 5 => array(1,1,1.5,2),
|
---|
| 12 | 7 => array(1,2,10,3,2),
|
---|
| 13 | 8 => array(2,3,1,3,1,2),
|
---|
| 14 | );
|
---|
| 15 |
|
---|
| 16 | // First create a new windrose graph with a title
|
---|
| 17 | $graph = new WindroseGraph(590,580);
|
---|
| 18 | $graph->title->Set('Japanese locale');
|
---|
| 19 | #$graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
|
---|
| 20 | $graph->title->SetColor('navy');
|
---|
| 21 |
|
---|
| 22 | // Create the free windrose plot.
|
---|
| 23 | $wp = new WindrosePlot($data);
|
---|
| 24 | $wp->SetType(WINDROSE_TYPE8);
|
---|
| 25 |
|
---|
| 26 | // Add some "arbitrary" text to the center
|
---|
| 27 | $wp->scale->SetZeroLabel("SOx\n8%%");
|
---|
| 28 |
|
---|
| 29 | // Localize the compass direction labels into Japanese
|
---|
| 30 | // Note: The labels for data must now also match the exact
|
---|
| 31 | // string for the compass directions.
|
---|
| 32 | //
|
---|
| 33 | // ãããæ±
|
---|
| 34 | // Nããåæ±
|
---|
| 35 | // ãããå
|
---|
| 36 | // Nããå西
|
---|
| 37 | // ããã西
|
---|
| 38 | // Sããå西
|
---|
| 39 | // ãããå
|
---|
| 40 | // Sããåæ±
|
---|
| 41 | $jp_CompassLbl = array('æ±','','åæ±','','å','','å西','',
|
---|
| 42 | '西','','å西','','å','','åæ±','');
|
---|
| 43 | $wp->SetCompassLabels($jp_CompassLbl);
|
---|
| 44 | #$wp->SetFont(FF_MINCHO,FS_NORMAL,15);
|
---|
| 45 |
|
---|
| 46 | // Localize the "Calm" text into Swedish and make the circle
|
---|
| 47 | // slightly bigger than default
|
---|
| 48 | $jp_calmtext = 'å¹³ç©';
|
---|
| 49 | $wp->legend->SetCircleText($jp_calmtext);
|
---|
| 50 | $wp->legend->SetCircleRadius(20);
|
---|
| 51 | #$wp->legend->SetCFont(FF_MINCHO,FS_NORMAL,10);
|
---|
| 52 | $wp->legend->SetMargin(5,0);
|
---|
| 53 | $wp->SetPos(0.5, 0.5);
|
---|
| 54 |
|
---|
| 55 | // Adjust the displayed ranges
|
---|
| 56 | $ranges = array(1,3,5,8,12,19,29);
|
---|
| 57 | $wp->SetRanges($ranges);
|
---|
| 58 |
|
---|
| 59 | // Set the scale to always have max value of 30
|
---|
| 60 | $wp->scale->Set(30,10);
|
---|
| 61 | #$wp->scale->SetFont(FF_VERA,FS_NORMAL,12);
|
---|
| 62 |
|
---|
| 63 | // Finally add it to the graph and send back to client
|
---|
| 64 | $graph->Add($wp);
|
---|
| 65 | $graph->Stroke();
|
---|
| 66 | ?>
|
---|
| 67 |
|
---|