Line | |
---|
1 | <?php
|
---|
2 | require_once ('jpgraph/jpgraph.php');
|
---|
3 | require_once ('jpgraph/jpgraph_odo.php');
|
---|
4 |
|
---|
5 | // Create a new odometer graph
|
---|
6 | $graph = new OdoGraph(300,320);
|
---|
7 |
|
---|
8 | // Setup graph titles
|
---|
9 | $graph->title->Set('Manual positioning');
|
---|
10 | $graph->title->SetColor('white');
|
---|
11 | $graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
|
---|
12 |
|
---|
13 | // Add drop shadow for graph
|
---|
14 | $graph->SetShadow();
|
---|
15 |
|
---|
16 | // Now we need to create an odometer to add to the graph.
|
---|
17 | $odo1 = new Odometer();
|
---|
18 | $odo2 = new Odometer();
|
---|
19 | $odo1->SetColor('lightgray:1.9');
|
---|
20 | $odo2->SetColor('lightgray:1.9');
|
---|
21 |
|
---|
22 | // Set display value for the odometer
|
---|
23 | $odo1->needle->Set(37);
|
---|
24 | $odo2->needle->Set(73);
|
---|
25 |
|
---|
26 | // Add drop shadow for needle
|
---|
27 | $odo1->needle->SetShadow();
|
---|
28 | $odo2->needle->SetShadow();
|
---|
29 |
|
---|
30 | // Specify the position for the two odometers
|
---|
31 | $odo1->SetPos(180,110);
|
---|
32 | $odo1->SetSize(100);
|
---|
33 | $odo2->SetPos(110,250);
|
---|
34 | $odo2->SetSize(100);
|
---|
35 |
|
---|
36 | // Set captions for the odometers
|
---|
37 | $odo1->caption->Set("(x,y) = (180,120)\nradius=100");
|
---|
38 | $odo2->caption->Set("(x,y) = (110,270)\nradius=100");
|
---|
39 |
|
---|
40 | // Add the odometer to the graph
|
---|
41 | $graph->Add($odo1);
|
---|
42 | $graph->Add($odo2);
|
---|
43 |
|
---|
44 | // ... and finally stroke and stream the image back to the browser
|
---|
45 | $graph->Stroke();
|
---|
46 | ?> |
---|
Note:
See
TracBrowser
for help on using the repository browser.