source: trunk/xgraph/jpgraph/Examples/odotutex09.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.1 KB
Line 
1<?php
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_odo.php');
4
5// Create a new odometer graph (width=250, height=200 pixels)
6$graph = new OdoGraph(600,300);
7
8$odo = array();
9$astyles = array(
10        NEEDLE_ARROW_SS,NEEDLE_ARROW_SM,NEEDLE_ARROW_SL,
11        NEEDLE_ARROW_MS,NEEDLE_ARROW_MM, NEEDLE_ARROW_ML,
12        NEEDLE_ARROW_LS, NEEDLE_ARROW_LM, NEEDLE_ARROW_LL
13        );
14$acaptions = array(
15        'SS','SM','SL','MS','MM','ML','LS','LM','LL'
16);
17
18for($i = 0; $i < 9; ++$i ) {
19        $odo[$i] =      new Odometer();
20        $odo[$i]->SetColor("lightyellow");
21        $odo[$i]->needle->Set(75);
22        $odo[$i]->needle->SetStyle(NEEDLE_STYLE_ENDARROW, $astyles[$i]);
23        $odo[$i]->caption->SetFont(FF_FONT1);
24        $odo[$i]->caption->Set($acaptions[$i]);
25        $odo[$i]->SetMargin(15);
26}
27
28$row1 = new LayoutHor( array($odo[0],$odo[1],$odo[2]) );
29$row2 = new LayoutHor( array($odo[3],$odo[4],$odo[5]) );
30$row3 = new LayoutHor( array($odo[6],$odo[7],$odo[8]) );
31$col1 = new LayoutVert( array($row1,$row2,$row3) );
32
33// Add the odometer to the graph
34$graph->Add($col1);
35
36// ... and finally stroke and stream the image back to the browser
37$graph->Stroke();
38?>
Note: See TracBrowser for help on using the repository browser.