Ejemplo n.º 1
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();
Ejemplo n.º 2
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
Ejemplo n.º 3
0
$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");
$odo2->scale->label->SetColor("blue");
$odo3->scale->label->SetColor("darkred");
$odo1->scale->label->SetFont(FF_FONT1);
$odo2->scale->label->SetFont(FF_FONT2, FS_BOLD);
$odo3->scale->label->SetFont(FF_ARIAL, FS_BOLD, 10);
//---------------------------------------------------------------------
// Add the odometers to the graph using a vertical layout
//---------------------------------------------------------------------
$l1 = new LayoutVert(array($odo1, $odo2, $odo3));
$graph->Add($l1);
//---------------------------------------------------------------------
// ... and finally stroke and stream the image back to the browser
//---------------------------------------------------------------------
$graph->Stroke();
// EOF
Ejemplo n.º 4
0
//---------------------------------------------------------------------
$odo1->needle->Set(17);
$odo2->needle->Set(47);
$odo3->needle->Set(86);
$odo4->needle->Set(22);
$odo5->needle->Set(77);
$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");
$odo2->scale->label->SetColor("blue");
$odo3->scale->label->SetColor("darkred");
$odo1->scale->label->SetFont(FF_FONT1);
$odo2->scale->label->SetFont(FF_FONT2, FS_BOLD);
$odo3->scale->label->SetFont(FF_ARIAL, FS_BOLD, 10);
//---------------------------------------------------------------------
// Add the odometers to the graph using a vertical layout
//---------------------------------------------------------------------
$l1 = new LayoutVert(array($odo1, $odo2, $odo3));
$l2 = new LayoutVert(array($odo4, $odo5));
$l3 = new LayoutHor(array($l1, $l2));
$graph->Add($l3);
//---------------------------------------------------------------------
// ... and finally stroke and stream the image back to the browser
//---------------------------------------------------------------------
$graph->Stroke();
// EOF
Ejemplo n.º 5
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(600, 300);
$odo = array();
$astyles = array(NEEDLE_ARROW_SS, NEEDLE_ARROW_SM, NEEDLE_ARROW_SL, NEEDLE_ARROW_MS, NEEDLE_ARROW_MM, NEEDLE_ARROW_ML, NEEDLE_ARROW_LS, NEEDLE_ARROW_LM, NEEDLE_ARROW_LL);
$acaptions = array('SS', 'SM', 'SL', 'MS', 'MM', 'ML', 'LS', 'LM', 'LL');
for ($i = 0; $i < 9; ++$i) {
    $odo[$i] = new Odometer();
    $odo[$i]->SetColor("lightyellow");
    $odo[$i]->needle->Set(75);
    $odo[$i]->needle->SetStyle(NEEDLE_STYLE_ENDARROW, $astyles[$i]);
    $odo[$i]->caption->SetFont(FF_FONT1);
    $odo[$i]->caption->Set($acaptions[$i]);
    $odo[$i]->SetMargin(15);
}
$row1 = new LayoutHor(array($odo[0], $odo[1], $odo[2]));
$row2 = new LayoutHor(array($odo[3], $odo[4], $odo[5]));
$row3 = new LayoutHor(array($odo[6], $odo[7], $odo[8]));
$col1 = new LayoutVert(array($row1, $row2, $row3));
// Add the odometer to the graph
$graph->Add($col1);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
Ejemplo n.º 6
0
    $odo[$i] = new Odometer();
    $odo[$i]->SetColor('lightgray:1.9');
    $odo[$i]->needle->Set(10 + $i * 17);
    $odo[$i]->needle->SetShadow();
    if ($i < 2) {
        $fsize = 10;
    } else {
        $fsize = 8;
    }
    $odo[$i]->scale->label->SetFont(FF_ARIAL, FS_NORMAL, $fsize);
    $odo[$i]->AddIndication(92, 100, 'red');
    $odo[$i]->AddIndication(80, 92, 'orange');
    $odo[$i]->AddIndication(60, 80, 'yellow');
}
// Create the layout
$row1 = new LayoutHor(array($odo[0], $odo[1]));
$row2 = new LayoutHor(array($odo[2], $odo[3], $odo[4]));
$col1 = new LayoutVert(array($row1, $row2));
// Add the odometer to the graph
$graph->Add($col1);
// Add an icon and text
$icon = new IconPlot('jpglogo.jpg', 250, 10, 0.85, 30);
$icon->SetAnchor('center', 'top');
$graph->Add($icon);
$t = new Text('JpGraph', 250, 70);
$t->SetAlign('center', 'top');
#$t->SetFont(FF_VERA,FS_BOLD,11);
$t->SetColor('darkgray');
$graph->Add($t);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();
Ejemplo n.º 7
0
$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
$graph->Add($odo1);
$graph->Add($odo2);
// ... and finally stroke and stream the image back to the browser
$graph->Stroke();