Beispiel #1
0
// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
// Some data
$data = array(array(80, 18, 15, 17), array(35, 28, 6, 34), array(10, 28, 10, 5), array(22, 22, 10, 17));
$piepos = array(0.2, 0.4, 0.65, 0.28, 0.25, 0.75, 0.8, 0.75);
$titles = array('USA', 'Sweden', 'South America', 'Australia');
$n = count($piepos) / 2;
define('DEFAULT_THEME_CLASS', 'NoTheme');
// A new Graph\Graph
$graph = new Graph\PieGraph(550, 400, 'auto');
// Specify margins since we put the image in the plot area
$graph->SetMargin(1, 1, 40, 1);
$graph->SetMarginColor('navy');
$graph->SetShadow(false);
// Setup background
$graph->SetBackgroundImage('worldmap1.jpg', BGIMG_FILLPLOT);
// Setup title
$graph->title->Set("Pie plots with background image");
$graph->title->SetFont(FF_ARIAL, FS_BOLD, 20);
$graph->title->SetColor('white');
$p = array();
// Create the plots
for ($i = 0; $i < $n; ++$i) {
    $d = "data{$i}";
    $p[] = new Plot\PiePlot3D($data[$i]);
}
// Position the four pies
for ($i = 0; $i < $n; ++$i) {
    $p[$i]->SetCenter($piepos[2 * $i], $piepos[2 * $i + 1]);
Beispiel #2
0
<?php

// content="text/plain; charset=utf-8"
require_once '../../vendor/autoload.php';
use Amenadiel\JpGraph\Graph;
use Amenadiel\JpGraph\Plot;
//$gJpgBrandTiming=true;
// Some data
$data = array(40, 21, 17, 27, 23);
// Create the Pie Graph.
$graph = new Graph\PieGraph(400, 200, 'auto');
$graph->SetShadow();
// Set A title for the plot
$graph->title->Set("3D Pie Client side image map");
$graph->title->SetFont(FF_FONT1, FS_BOLD);
// Create
$p1 = new Plot\PiePlot3D($data);
$p1->SetLegends(array("Jan (%d)", "Feb", "Mar", "Apr", "May", "Jun", "Jul"));
$targ = array("pie3d_csimex1.php?v=1", "pie3d_csimex1.php?v=2", "pie3d_csimex1.php?v=3", "pie3d_csimex1.php?v=4", "pie3d_csimex1.php?v=5", "pie3d_csimex1.php?v=6");
$alts = array("val=%d", "val=%d", "val=%d", "val=%d", "val=%d", "val=%d");
$p1->SetCSIMTargets($targ, $alts);
// Use absolute labels
$p1->SetLabelType(1);
$p1->value->SetFormat("%d kr");
// Move the pie slightly to the left
$p1->SetCenter(0.4, 0.5);
$graph->Add($p1);
// Send back the HTML page which will call this script again
// to retrieve the image.
$graph->StrokeCSIM();