setShowCategoryName() 공개 메소드

Set ShowCategoryName
public setShowCategoryName ( boolean $value ) : Series
$value boolean
리턴 Series
예제 #1
0
 public function testShowCategoryName()
 {
     $object = new Series();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowCategoryName(true));
     $this->assertTrue($object->hasShowCategoryName());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowCategoryName(false));
     $this->assertFalse($object->hasShowCategoryName());
 }
예제 #2
0
function fnSlide_Pie(PhpPresentation $objPHPPresentation)
{
    global $oFill;
    global $oShadow;
    // Create templated slide
    echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
    $currentSlide = createTemplatedSlide($objPHPPresentation);
    // Generate sample data for second chart
    echo date('H:i:s') . ' Generate sample data for chart' . EOL;
    $seriesData = array('Monday' => 18, 'Tuesday' => 23, 'Wednesday' => 14, 'Thursday' => 12, 'Friday' => 20, 'Saturday' => 8, 'Sunday' => 10);
    // Create a pie chart (that should be inserted in a shape)
    echo date('H:i:s') . ' Create a non-3D pie chart (that should be inserted in a chart shape)' . EOL;
    $pieChart = new Pie();
    $pieChart->setExplosion(15);
    $series = new Series('Downloads', $seriesData);
    $series->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF7CB5EC'));
    $series->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF434348'));
    $series->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF90ED7D'));
    $series->getDataPointFill(3)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF7A35C'));
    $series->getDataPointFill(4)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8085E9'));
    $series->getDataPointFill(5)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFF15C80'));
    $series->getDataPointFill(6)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE4D354'));
    $series->setShowPercentage(true);
    $series->setShowValue(false);
    $series->setShowSeriesName(false);
    $series->setShowCategoryName(true);
    $pieChart->addSeries($series);
    // Create a shape (chart)
    echo date('H:i:s') . ' Create a shape (chart)' . EOL;
    $shape = $currentSlide->createChartShape();
    $shape->setName('PHPPresentation Daily Downloads')->setResizeProportional(false)->setHeight(550)->setWidth(700)->setOffsetX(120)->setOffsetY(80);
    $shape->setShadow($oShadow);
    $shape->setFill($oFill);
    $shape->getBorder()->setLineStyle(Border::LINE_SINGLE);
    $shape->getTitle()->setText('PHPPresentation Daily Downloads');
    $shape->getTitle()->getFont()->setItalic(true);
    $shape->getPlotArea()->setType($pieChart);
    $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
    $shape->getLegend()->getFont()->setItalic(true);
}