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 | 0 => array(3,2,1,2,2),
|
---|
9 | 4 => array(1,1,1.5,2),
|
---|
10 | 6 => array(1,1,1.5,2),
|
---|
11 | 12 => array(2,3,5,1),
|
---|
12 | );
|
---|
13 |
|
---|
14 | $xpos1 = 0.26;
|
---|
15 | $xpos2 = 0.74;
|
---|
16 | $ypos1 = 0.5;
|
---|
17 | $ypos2 = 0.9;
|
---|
18 |
|
---|
19 | // First create a new windrose graph with a title
|
---|
20 | $graph = new WindroseGraph(650,350);
|
---|
21 | $graph->title->Set('Interpretation of ordinal keys');
|
---|
22 | $graph->title->SetFont(FF_VERDANA,FS_BOLD,14);
|
---|
23 | $graph->title->SetColor('navy');
|
---|
24 |
|
---|
25 | // Create the first plot
|
---|
26 | $wp1 = new WindrosePlot($data);
|
---|
27 | $wp1->SetType(WINDROSE_TYPE16);
|
---|
28 |
|
---|
29 | // This is the default encoding
|
---|
30 | $wp1->SetDataKeyEncoding(KEYENCODING_ANTICLOCKWISE);
|
---|
31 | $wp1->legend->Hide();
|
---|
32 | $wp1->SetPos($xpos1,$ypos1);
|
---|
33 | $wp1->SetSize(0.5);
|
---|
34 |
|
---|
35 | // Create the second plot
|
---|
36 | $wp2 = new WindrosePlot($data);
|
---|
37 | $wp2->SetType(WINDROSE_TYPE16);
|
---|
38 | $wp2->SetDataKeyEncoding(KEYENCODING_CLOCKWISE);
|
---|
39 | $wp2->legend->Hide();
|
---|
40 | $wp2->SetPos($xpos2,$ypos1);
|
---|
41 | $wp2->SetSize(0.5);
|
---|
42 |
|
---|
43 | $txt1 = new Text('KEYENCODING_ANTICLOCKWISE');
|
---|
44 | $txt1->SetFont(FF_COURIER,FS_BOLD,12);
|
---|
45 | $txt1->SetPos($xpos1,$ypos2);
|
---|
46 | $txt1->SetAlign('center','top');
|
---|
47 |
|
---|
48 | $txt2 = new Text('KEYENCODING_CLOCKWISE');
|
---|
49 | $txt2->SetFont(FF_COURIER,FS_BOLD,12);
|
---|
50 | $txt2->SetPos($xpos2,$ypos2);
|
---|
51 | $txt2->SetAlign('center','top');
|
---|
52 |
|
---|
53 | // Finally add it to the graph and send back to the client
|
---|
54 | $graph->Add($wp1);
|
---|
55 | $graph->Add($txt1);
|
---|
56 |
|
---|
57 | $graph->Add($wp2);
|
---|
58 | $graph->Add($txt2);
|
---|
59 |
|
---|
60 | $graph->Stroke();
|
---|
61 | ?>
|
---|
62 |
|
---|