Rev | Line | |
---|
[42] | 1 | <?php |
---|
| 2 | require_once ('jpgraph/jpgraph.php'); |
---|
| 3 | require_once ('jpgraph/jpgraph_odo.php'); |
---|
| 4 | |
---|
| 5 | // Create a new odometer graph (width=250, height=200 pixels) |
---|
| 6 | $graph = new OdoGraph(250,160); |
---|
| 7 | $graph->title->Set('Custom scale'); |
---|
| 8 | $graph->title->SetColor('white'); |
---|
| 9 | $graph->title->SetFont(FF_ARIAL,FS_BOLD); |
---|
| 10 | |
---|
| 11 | // Add drop shadow for graph |
---|
| 12 | $graph->SetShadow(); |
---|
| 13 | |
---|
| 14 | // Now we need to create an odometer to add to the graph. |
---|
| 15 | // By default the scale will be 0 to 100 |
---|
| 16 | $odo = new Odometer(); |
---|
| 17 | $odo->SetColor('lightyellow'); |
---|
| 18 | |
---|
| 19 | // Setup the scale |
---|
| 20 | $odo->scale->Set(100,600); |
---|
| 21 | $odo->scale->SetTicks(50,2); |
---|
| 22 | |
---|
| 23 | // Set display value for the odometer |
---|
| 24 | $odo->needle->Set(280); |
---|
| 25 | |
---|
| 26 | // Add drop shadow for needle |
---|
| 27 | $odo->needle->SetShadow(); |
---|
| 28 | |
---|
| 29 | // Add the odometer to the graph |
---|
| 30 | $graph->Add($odo); |
---|
| 31 | |
---|
| 32 | // ... and finally stroke and stream the image back to the browser |
---|
| 33 | $graph->Stroke(); |
---|
| 34 | |
---|
| 35 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.