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,140); |
---|
| 7 | |
---|
| 8 | // Setup a title |
---|
| 9 | $graph->title->Set('An example with drop shadows'); |
---|
| 10 | |
---|
| 11 | // Add drop shadow for graph |
---|
| 12 | $graph->SetShadow(); |
---|
| 13 | |
---|
| 14 | // Set some nonstandard colors |
---|
| 15 | $color = array(205,220,205); |
---|
| 16 | $graph->SetMarginColor($color); |
---|
| 17 | $graph->SetColor($color); |
---|
| 18 | |
---|
| 19 | // Now we need to create an odometer to add to the graph. |
---|
| 20 | // By default the scale will be 0 to 100 |
---|
| 21 | $odo = new Odometer(); |
---|
| 22 | $odo->SetColor('white'); |
---|
| 23 | |
---|
| 24 | // Set display value for the odometer |
---|
| 25 | $odo->needle->Set(70); |
---|
| 26 | |
---|
| 27 | // Add drop shadow for needle |
---|
| 28 | $odo->needle->SetShadow(); |
---|
| 29 | |
---|
| 30 | // Add the odometer to the graph |
---|
| 31 | $graph->Add($odo); |
---|
| 32 | |
---|
| 33 | // ... and finally stroke and stream the image back to the browser |
---|
| 34 | $graph->Stroke(); |
---|
| 35 | |
---|
| 36 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.