[42] | 1 | <?php
|
---|
| 2 | //=============================================================================
|
---|
| 3 | // File: ODOEX09.PHP
|
---|
| 4 | // Description: Example 0 for odometer graphs
|
---|
| 5 | // Created: 2002-02-22
|
---|
| 6 | // Version: $Id$
|
---|
| 7 | //
|
---|
| 8 | // Comment:
|
---|
| 9 | // Example file for odometer graph. Extends odoex00.php to show how multiple
|
---|
| 10 | // odometers may be combined in the same graph.
|
---|
| 11 | //
|
---|
| 12 | // Copyright (C) 2002 Johan Persson. All rights reserved.
|
---|
| 13 | //=============================================================================
|
---|
| 14 | require_once ('jpgraph/jpgraph.php');
|
---|
| 15 | require_once ('jpgraph/jpgraph_odo.php');
|
---|
| 16 |
|
---|
| 17 | //---------------------------------------------------------------------
|
---|
| 18 | // Create a new odometer graph (width=250, height=200 pixels)
|
---|
| 19 | //---------------------------------------------------------------------
|
---|
| 20 | $graph = new OdoGraph(200,300);
|
---|
| 21 |
|
---|
| 22 | //---------------------------------------------------------------------
|
---|
| 23 | // We will display three odometers stacked vertically
|
---|
| 24 | // The first thing to do is to create them
|
---|
| 25 | //---------------------------------------------------------------------
|
---|
| 26 | $odo1 = new Odometer();
|
---|
| 27 | $odo2 = new Odometer();
|
---|
| 28 | $odo3 = new Odometer();
|
---|
| 29 |
|
---|
| 30 | //---------------------------------------------------------------------
|
---|
| 31 | // Set display value for the odometers
|
---|
| 32 | //---------------------------------------------------------------------
|
---|
| 33 | $odo1->needle->Set(17);
|
---|
| 34 | $odo2->needle->Set(47);
|
---|
| 35 | $odo3->needle->Set(86);
|
---|
| 36 |
|
---|
| 37 | //---------------------------------------------------------------------
|
---|
| 38 | // Add the odometers to the graph using a vertical layout
|
---|
| 39 | //---------------------------------------------------------------------
|
---|
| 40 | $l1 = new LayoutVert( array($odo1,$odo2,$odo3) ) ;
|
---|
| 41 | $graph->Add( $l1 );
|
---|
| 42 |
|
---|
| 43 | //---------------------------------------------------------------------
|
---|
| 44 | // ... and finally stroke and stream the image back to the browser
|
---|
| 45 | //---------------------------------------------------------------------
|
---|
| 46 | $graph->Stroke();
|
---|
| 47 |
|
---|
| 48 | // EOF
|
---|
| 49 | ?> |
---|