source: trunk/xgraph/jpgraph/Examples/odotutex04.php @ 42

Last change on this file since 42 was 42, checked in by marrucho, 10 years ago
File size: 1.2 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,200);
7
8// Setup titles
9$graph->title->Set("Result for 2002");
10$graph->title->SetColor("white");
11$graph->title->SetFont(FF_ARIAL,FS_BOLD,14);
12$graph->subtitle->Set("New York Office");
13$graph->subtitle->SetColor("white");
14$graph->caption->Set("Figure 1.This is a very, very\nlong text with multiples lines\nthat are added as a caption.");
15$graph->caption->SetColor("white");
16
17// Setup colors
18// Make the border 40% darker than normal "khaki"
19$graph->SetMarginColor("khaki:0.6");
20$graph->SetColor("khaki");
21
22// Now we need to create an odometer to add to the graph.
23// By default the scale will be 0 to 100
24$odo = new Odometer();
25
26// Setup colors for odometyer plot
27$odo->SetColor('white');
28$odo->scale->label->SetColor("darkred");
29$odo->needle->SetFillColor("yellow");
30
31// Set display value for the odometer
32$odo->needle->Set(30);
33
34// Add the odometer to the graph
35$graph->Add($odo);
36
37// ... and finally stroke and stream the image back to the client
38$graph->Stroke();
39
40?>
Note: See TracBrowser for help on using the repository browser.