示例#1
0
$graph2 = new Graph($w, 110);
$graph2->SetScale('linlin', 0, 0, $xmin, $xmax);
$graph2->SetMargin($lm, $rm, 5, 10);
$graph2->SetMarginColor('white');
$graph2->SetFrame(false);
$graph2->SetBox(true);
$graph2->xgrid->Show();
$graph2->xaxis->SetTickPositions($tickPositions, $minTickPositions);
$graph2->xaxis->SetLabelFormatString('My', true);
$graph2->xaxis->SetPos('max');
$graph2->xaxis->HideLabels();
$graph2->xaxis->SetTickSide(SIDE_DOWN);
$b1 = new BarPlot($datay2, $datax);
$b1->SetFillColor('teal');
$b1->SetColor('teal:1.2');
$graph2->Add($b1);
//-----------------------
// Create a multigraph
//----------------------
$mgraph = new MGraph();
$mgraph->SetImgFormat('jpeg', 60);
$mgraph->SetMargin(2, 2, 2, 2);
$mgraph->SetFrame(true, 'darkgray', 2);
$mgraph->SetBackgroundImage('tiger1.jpg');
$mgraph->AddMix($graph, 0, 0, 85);
$mgraph->AddMix($graph2, 0, 250, 85);
$mgraph->Stroke();
?>


示例#2
0
 $yTickWidth = "({$yTickWidth}).0";
 $yTickWidth = strlen($yTickWidth) * 7;
 $widthWeek = 70 * $contributionStat['nbCols'] + 100 + $legendWidth;
 $widthTotal = 70 + 100 + $legendWidth + $yTickWidth;
 $height = 250;
 $widthUser = 70 * $userContributions['nbCols'] + 100 + $legendWidth + $yTickWidth;
 $widthGroup = 70 * count($groupContributions) + 100 + $legendWidth + $yTickWidth;
 $space = 20;
 if ($prefs['feature_jpgraph'] == 'y') {
     require_once 'lib/jpgraph/src/jpgraph.php';
     require_once 'lib/jpgraph/src/jpgraph_bar.php';
     require_once 'lib/jpgraph/src/jpgraph_mgraph.php';
     $imagegallib = TikiLib::lib('imagegal');
     $ext = 'jpeg';
     $background = new MGraph();
     $background->SetImgFormat($ext);
     $background->SetFrame(true, 'black');
     $background->SetMargin(10, 10, 10, 10);
 } else {
     require_once 'lib/sheet/grid.php';
     require_once 'lib/graph-engine/gd.php';
     require_once 'lib/graph-engine/pdflib.php';
     require_once 'lib/graph-engine/ps.php';
     require_once 'lib/graph-engine/graph.pie.php';
     require_once 'lib/graph-engine/graph.bar.php';
     require_once 'lib/graph-engine/graph.multiline.php';
     $graphType = 'BarStackGraphic';
     $ext = 'jpg';
     $background = new GD_GRenderer(max($widthUser, $widthWeek), 8 * $height, $ext);
     $legendWidth = 300;
 }