addFont() 공개 메소드

Add a font to available fonts
public addFont ( string $font ) : Graph
$font string
리턴 Graph
예제 #1
0
 public function testAddPieChart()
 {
     $pie = array('x' => 320, 'y' => 240, 'w' => 200, 'h' => 100);
     $percents = array(array(10, new Rgb(200, 15, 15)), array(8, new Rgb(80, 5, 10)), array(12, new Rgb(80, 180, 100)), array(18, new Rgb(50, 125, 210)), array(22, new Rgb(80, 180, 10)), array(18, new Rgb(100, 125, 210)), array(12, new Rgb(80, 180, 10)));
     $this->setExpectedException('Pop\\Http\\Exception');
     $g = new Graph($this->pdfOptions);
     $g->addFont('Arial')->setFontColor(new Rgb(128, 128, 128))->showText(true)->createPieChart($pie, $percents, 20)->output();
 }
예제 #2
0
<?php

require_once '../../bootstrap.php';
use Pop\Color\Space\Rgb;
use Pop\Graph\Graph;
try {
    $x = array('1995', '2000', '2005', '2010', '2015');
    $y = array('0M', '50M', '100M', '150M', '200M');
    $data = array(array(1995, 0), array(1997, 35), array(1998, 25), array(2002, 100), array(2004, 84), array(2006, 98), array(2007, 76), array(2010, 122), array(2012, 175), array(2015, 162));
    $graph = new Graph(array('filename' => 'graph.gif', 'width' => 640, 'height' => 480));
    $graph->addFont('../assets/fonts/times.ttf')->setFontColor(new Rgb(128, 128, 128))->setFillColor(new Rgb(10, 125, 210))->showY(true)->showText(true)->createLineGraph($data, $x, $y)->output();
} catch (\Exception $e) {
    echo $e->getMessage();
}
예제 #3
0
<?php

require_once '../../bootstrap.php';
use Pop\Color\Space\Rgb;
use Pop\Graph\Graph;
try {
    $pie = array('x' => 320, 'y' => 240, 'w' => 200, 'h' => 100);
    $percents = array(array(10, new Rgb(200, 15, 15)), array(8, new Rgb(80, 5, 10)), array(12, new Rgb(80, 180, 100)), array(18, new Rgb(50, 125, 210)), array(22, new Rgb(80, 180, 10)), array(18, new Rgb(100, 125, 210)), array(12, new Rgb(80, 180, 10)));
    $graph = new Graph(array('filename' => 'graph.gif', 'width' => 640, 'height' => 480));
    $graph->addFont('../assets/fonts/times.ttf')->setFontColor(new Rgb(128, 128, 128))->showText(true)->createPieChart($pie, $percents, 20)->output();
} catch (\Exception $e) {
    echo $e->getMessage();
}