Exemple #1
0
<?php

require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_odo.php';
// Create a new odometer graph (width=250, height=200 pixels)
$graph = new OdoGraph(350, 100);
// Add drop shadow for graph
$graph->SetShadow();
// Now we need to create an odometer to add to the graph.
// By default the scale will be 0 to 100
$odo1 = new Odometer();
$odo2 = new Odometer();
$odo1->SetColor("lightgray:1.9");
$odo2->SetColor("lightgray:1.9");
// Adjust start and end angle for the scale
$odo2->scale->SetAngle(110, 250);
$odo1->scale->label->SetFont(FF_ARIAL, FS_BOLD, 10);
$odo2->scale->label->SetFont(FF_ARIAL, FS_BOLD, 10);
$odo2->AddIndication(-15, 0, 'lightgray');
$odo2->AddIndication(100, 115, 'lightgray');
// Set display value for the odometer
$odo1->needle->Set(70);
$odo2->needle->Set(70);
// Add drop shadow for needle
$odo1->needle->SetShadow();
$odo2->needle->SetShadow();
// Specify the layout for the two odometers
$row = new LayoutHor(array($odo1, $odo2));
// Add the odometer to the graph
$graph->Add($row);
// ... and finally stroke and stream the image back to the browser
Exemple #2
0
<?php

require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_odo.php';
// Create a new odometer graph (width=250, height=200 pixels)
$graph = new OdoGraph(250, 140);
// Setup a title
$graph->title->Set('An example with drop shadows');
// Add drop shadow for graph
$graph->SetShadow();
// Set some nonstandard colors
$color = array(205, 220, 205);
$graph->SetMarginColor($color);
$graph->SetColor($color);
// Now we need to create an odometer to add to the graph.
// By default the scale will be 0 to 100
$odo = new Odometer();
$odo->SetColor('white');
// Set display value for the odometer
$odo->needle->Set(70);
// Add drop shadow for needle
$odo->needle->SetShadow();
// Add the odometer to the graph
$graph->Add($odo);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
Exemple #3
0
// * (This is the text at the bottom of the graph.) The margins will
// automatically adjust to fit the height of the text. A caption
// may have multiple lines by including a '\n' character in the
// string.
//---------------------------------------------------------------------
$graph->caption->Set("First caption row\n... second row");
$graph->caption->SetColor("white");
//---------------------------------------------------------------------
// Now we need to create an odometer to add to the graph.
// By default the scale will be 0 to 100
//---------------------------------------------------------------------
$odo = new Odometer(ODO_FULL);
//---------------------------------------------------------------------
// Set fill color for odometer
//---------------------------------------------------------------------
$odo->SetColor("lightblue");
//---------------------------------------------------------------------
// Set color indication
//---------------------------------------------------------------------
$odo->AddIndication(0, 50, "green");
$odo->AddIndication(50, 80, "yellow");
$odo->AddIndication(80, 100, "red");
//---------------------------------------------------------------------
// Set the center area that will not be affected by the color bands
//---------------------------------------------------------------------
$odo->SetCenterAreaWidth(0.4);
// Fraction of radius
//---------------------------------------------------------------------
// Adjust scale ticks to be shown at 10 steps interval and scale
// labels at every second tick
//---------------------------------------------------------------------
Exemple #4
0
<?php

require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_odo.php';
// Create a new odometer graph (width=250, height=200 pixels)
$graph = new OdoGraph(250, 160);
$graph->title->Set('Custom scale');
$graph->title->SetColor('white');
$graph->title->SetFont(FF_ARIAL, FS_BOLD);
// Add drop shadow for graph
$graph->SetShadow();
// Now we need to create an odometer to add to the graph.
// By default the scale will be 0 to 100
$odo = new Odometer();
$odo->SetColor('lightyellow');
// Setup the scale
$odo->scale->Set(100, 600);
$odo->scale->SetTicks(50, 2);
// Set display value for the odometer
$odo->needle->Set(280);
// Add drop shadow for needle
$odo->needle->SetShadow();
// Add the odometer to the graph
$graph->Add($odo);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
Exemple #5
0
require_once 'jpgraph/jpgraph.php';
require_once 'jpgraph/jpgraph_odo.php';
// Create a new odometer graph
$graph = new OdoGraph(300, 320);
// Setup graph titles
$graph->title->Set('Manual positioning');
$graph->title->SetColor('white');
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 14);
// Add drop shadow for graph
$graph->SetShadow();
// Now we need to create an odometer to add to the graph.
$odo1 = new Odometer();
$odo2 = new Odometer();
$odo1->SetColor('lightgray:1.9');
$odo2->SetColor('lightgray:1.9');
// Set display value for the odometer
$odo1->needle->Set(37);
$odo2->needle->Set(73);
// Add drop shadow for needle
$odo1->needle->SetShadow();
$odo2->needle->SetShadow();
// Specify the position for the two odometers
$odo1->SetPos(180, 110);
$odo1->SetSize(100);
$odo2->SetPos(110, 250);
$odo2->SetSize(100);
// Set captions for the odometers
$odo1->caption->Set("(x,y) = (180,120)\nradius=100");
$odo2->caption->Set("(x,y) = (110,270)\nradius=100");
// Add the odometer to the graph