Line | |
---|
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(350,100);
|
---|
7 |
|
---|
8 | // Add drop shadow for graph
|
---|
9 | $graph->SetShadow();
|
---|
10 |
|
---|
11 | // Now we need to create an odometer to add to the graph.
|
---|
12 | // By default the scale will be 0 to 100
|
---|
13 | $odo1 = new Odometer();
|
---|
14 | $odo2 = new Odometer();
|
---|
15 | $odo1->SetColor("lightgray:1.9");
|
---|
16 | $odo2->SetColor("lightgray:1.9");
|
---|
17 |
|
---|
18 | // Adjust start and end angle for the scale
|
---|
19 | $odo2->scale->SetAngle(110,250);
|
---|
20 |
|
---|
21 | $odo1->scale->label->SetFont(FF_ARIAL,FS_BOLD,10);
|
---|
22 | $odo2->scale->label->SetFont(FF_ARIAL,FS_BOLD,10);
|
---|
23 |
|
---|
24 | // Set display value for the odometer
|
---|
25 | $odo1->needle->Set(70);
|
---|
26 | $odo2->needle->Set(70);
|
---|
27 |
|
---|
28 | // Add drop shadow for needle
|
---|
29 | $odo1->needle->SetShadow();
|
---|
30 | $odo2->needle->SetShadow();
|
---|
31 |
|
---|
32 | // Specify the layout for the two odometers
|
---|
33 | $row = new LayoutHor( array($odo1,$odo2) );
|
---|
34 |
|
---|
35 | // Add the odometer to the graph
|
---|
36 | $graph->Add($row);
|
---|
37 |
|
---|
38 | // ... and finally stroke and stream the image back to the browser
|
---|
39 | $graph->Stroke();
|
---|
40 | ?> |
---|
Note:
See
TracBrowser
for help on using the repository browser.