source: trunk/xgraph/jpgraph/Examples/odotutex10.php

Last change on this file was 42, checked in by marrucho, 10 years ago
File size: 1.3 KB
Line 
1<?php
2require_once ('jpgraph/jpgraph.php');
3require_once ('jpgraph/jpgraph_odo.php');
4
5// Create a new odometer graph (width=250, height=200 pixels)
6$graph = new OdoGraph(250,150);
7
8$graph->title->Set('Example with scale indicators');
9
10// Add drop shadow for graph
11$graph->SetShadow();
12
13// Now we need to create an odometer to add to the graph.
14// By default the scale will be 0 to 100
15$odo = new Odometer(ODO_HALF);
16
17// Add color indications
18$odo->AddIndication(0,20,"green:0.7");
19$odo->AddIndication(20,30,"green:0.9");
20$odo->AddIndication(30,60,"yellow");
21$odo->AddIndication(60,80,"orange");
22$odo->AddIndication(80,100,"red");
23
24// Set display value for the odometer
25$odo->needle->Set(90);
26
27//---------------------------------------------------------------------
28// Add drop shadow for needle
29//---------------------------------------------------------------------
30$odo->needle->SetShadow();
31
32//---------------------------------------------------------------------
33// Add the odometer to the graph
34//---------------------------------------------------------------------
35$graph->Add($odo);
36
37//---------------------------------------------------------------------
38// ... and finally stroke and stream the image back to the browser
39//---------------------------------------------------------------------
40$graph->Stroke();
41
42// EOF
43?>
Note: See TracBrowser for help on using the repository browser.