Beispiel #1
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();
//---------------------------------------------------------------------
// Set color indication
//---------------------------------------------------------------------
$odo->AddIndication(0, 50, "green");
$odo->AddIndication(50, 80, "yellow");
$odo->AddIndication(80, 100, "red");
//---------------------------------------------------------------------
// Set display value for the odometer
//---------------------------------------------------------------------
$odo->needle->Set(30);
//---------------------------------------------------------------------
// Add the odometer to the graph
//---------------------------------------------------------------------
$graph->Add($odo);
//---------------------------------------------------------------------
// ... and finally stroke and stream the image back to the browser
//---------------------------------------------------------------------
$graph->Stroke();
// EOF
Beispiel #2
0
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
$graph->Stroke();
Beispiel #3
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, 150);
$graph->title->Set('Example with scale indicators');
// 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_HALF);
// Add color indications
$odo->AddIndication(0, 20, "green:0.7");
$odo->AddIndication(20, 30, "green:0.9");
$odo->AddIndication(30, 60, "yellow");
$odo->AddIndication(60, 80, "orange");
$odo->AddIndication(80, 100, "red");
$odo->SetCenterAreaWidth(0.45);
// Set display value for the odometer
$odo->needle->Set(90);
// Add scale labels
$odo->label->Set("mBar");
$odo->label->SetFont(FF_FONT2, FS_BOLD);
// 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();
Beispiel #4
0
//---------------------------------------------------------------------
// Set caption for each odometer
//---------------------------------------------------------------------
$odo1->caption->Set("April");
$odo1->caption->SetFont(FF_FONT2, FS_BOLD);
$odo2->caption->Set("May");
$odo2->caption->SetFont(FF_FONT2, FS_BOLD);
$odo3->caption->Set("June");
$odo3->caption->SetFont(FF_FONT2, FS_BOLD);
//---------------------------------------------------------------------
// Set Indicator bands for the odometers
//---------------------------------------------------------------------
$odo1->AddIndication(80, 100, "red");
$odo2->AddIndication(20, 30, "green");
$odo2->AddIndication(65, 100, "red");
$odo3->AddIndication(60, 90, "yellow");
$odo3->AddIndication(90, 100, "red");
//---------------------------------------------------------------------
// Set display values for the odometers
//---------------------------------------------------------------------
$odo1->needle->Set(17);
$odo2->needle->Set(47);
$odo3->needle->Set(86);
$odo1->needle->SetFillColor("blue");
$odo2->needle->SetFillColor("yellow:0.7");
$odo3->needle->SetFillColor("black");
$odo3->needle->SetColor("black");
//---------------------------------------------------------------------
// Set scale label properties
//---------------------------------------------------------------------
$odo1->scale->label->SetColor("navy");
Beispiel #5
0
//---------------------------------------------------------------------
// Specify caption.
// * (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();
//---------------------------------------------------------------------
// Set color indication between values 80 and 100 as red
//---------------------------------------------------------------------
$odo->AddIndication(80, 100, "red");
//---------------------------------------------------------------------
// Set display value for the odometer
//---------------------------------------------------------------------
$odo->needle->Set(30);
//---------------------------------------------------------------------
// Add the odometer to the graph
//---------------------------------------------------------------------
$graph->Add($odo);
//---------------------------------------------------------------------
// ... and finally stroke and stream the image back to the browser
//---------------------------------------------------------------------
$graph->Stroke();
// EOF