Line | |
---|
1 | <?php |
---|
2 | require_once ('jpgraph/jpgraph.php'); |
---|
3 | require_once ('jpgraph/jpgraph_odo.php'); |
---|
4 | |
---|
5 | // Create a new odometer graph |
---|
6 | $graph = new OdoGraph(500,180); |
---|
7 | |
---|
8 | $odo = array(); |
---|
9 | |
---|
10 | // Now we need to create an odometer to add to the graph. |
---|
11 | for( $i=0; $i < 5; ++$i ) { |
---|
12 | $odo[$i] = new Odometer(); |
---|
13 | $odo[$i]->SetColor('lightgray:1.9'); |
---|
14 | $odo[$i]->needle->Set(10+$i*17); |
---|
15 | $odo[$i]->needle->SetShadow(); |
---|
16 | if( $i < 2 ) |
---|
17 | $fsize = 10; |
---|
18 | else |
---|
19 | $fsize = 8; |
---|
20 | $odo[$i]->scale->label->SetFont(FF_ARIAL,FS_NORMAL,$fsize); |
---|
21 | $odo[$i]->AddIndication(92,100,'red'); |
---|
22 | $odo[$i]->AddIndication(80,92,'orange'); |
---|
23 | $odo[$i]->AddIndication(60,80,'yellow'); |
---|
24 | } |
---|
25 | |
---|
26 | // Create the layout |
---|
27 | $row1 = new LayoutHor( array($odo[0],$odo[1]) ); |
---|
28 | $row2 = new LayoutHor( array($odo[2],$odo[3],$odo[4]) ); |
---|
29 | $col1 = new LayoutVert( array($row1,$row2) ); |
---|
30 | |
---|
31 | // Add the odometer to the graph |
---|
32 | $graph->Add($col1); |
---|
33 | |
---|
34 | // ... and finally stroke and stream the image back to the browser |
---|
35 | $graph->Stroke(); |
---|
36 | |
---|
37 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.