source: trunk/xgraph/jpgraph/Examples/windrose_ex7.1.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.8 KB
Line 
1<?php
2require_once ('jpgraph/jpgraph.php');
3require_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
Note: See TracBrowser for help on using the repository browser.