1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
| <?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_windrose.php');
$data = array(
0 => array(1,1,2.5,4),
1 => array(3,4,1,4),
3 => array(2,7,4,4,3),
5 => array(2,7,1,2));
$txt=array();
$txt[0] = "It is possible to add arbitrary,multi line, text to a graph. ";
$txt[0] .= "Such a paragraph can have it's text be left, right or center ";
$txt[0] .= "aligned.";
$txt[1] = "This is an example of a right aligned paragraph.";
$txt[2] = "Finally we can show a center aligned paragraph without box.";
$txtlayout = array(
array(0.97,0.15,25,'left','black','lightblue'),
array(0.97,0.4,20,'right','black','lightblue'),
array(0.97,0.7,20,'center','darkred',false,FF_COMIC,FS_NORMAL,12),
);
$rangeColors = array('silver','khaki','orange','brown','blue','navy','maroon','red');
$graph = new WindroseGraph(570,430);
$graph->title->Set('Windrose example 5');
$graph->title->SetFont(FF_VERDANA,FS_BOLD,12);
$graph->title->SetColor('navy');
$graph->SetColor('darkgreen@0.7');
$n = count($txt);
for( $i=0; $i < $n; ++$i ) {
$txtbox[$i] = new Text($txt[$i]);
$txtbox[$i]->SetPos($txtlayout[$i][0],$txtlayout[$i][1],'right');
$txtbox[$i]->SetWordwrap($txtlayout[$i][2]);
$txtbox[$i]->SetParagraphAlign($txtlayout[$i][3]);
$txtbox[$i]->SetColor($txtlayout[$i][4]);
$txtbox[$i]->SetBox($txtlayout[$i][5]);
if( count($txtlayout[$i]) > 6 )
$txtbox[$i]->SetFont($txtlayout[$i][6],$txtlayout[$i][7],$txtlayout[$i][8]);
}
$graph->Add($txtbox);
$wp = new WindrosePlot($data);
$wp->SetColor('lightyellow');
$wp->SetBox();
$wp->SetRangeColors($rangeColors);
$wp->scale->SetFont(FF_ARIAL,FS_NORMAL,9);
$wp->scale->SetFontColor('navy');
$wp->SetSize(190);
$wp->SetPos(0.35,0.53);
$wp->SetZCircleSize(0.2);
$wp->SetFont(FF_ARIAL,FS_NORMAL,10);
$wp->SetFontColor('darkgreen');
$wp->SetLabelMargin(50);
$wp->SetGridColor('silver','blue');
$wp->legend->SetText('(m/s)');
$wp->legend->SetMargin(20,5);
$graph->Add($wp);
$graph->Stroke();
?> |