setShowSeriesName() публичный Метод

Set ShowSeriesName
public setShowSeriesName ( boolean $value ) : Series
$value boolean
Результат Series
Пример #1
0
 public function testChartBarHorizontal()
 {
     $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
     $oSeries->setShowSeriesName(true);
     $oSeries->getDataPointFill(0)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF4672A8'));
     $oSeries->getDataPointFill(1)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFAB4744'));
     $oSeries->getDataPointFill(2)->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF8AA64F'));
     $oBar = new Bar();
     $oBar->setBarDirection(Bar::DIRECTION_HORIZONTAL);
     $oBar->addSeries($oSeries);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oChart = $oSlide->createChartShape();
     $oChart->getPlotArea()->setType($oBar);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:body/office:chart/chart:chart';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('chart:bar', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml'));
     $element = '/office:document-content/office:automatic-styles/style:style[@style:name=\'stylePlotArea\']/style:chart-properties';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('true', $pres->getElementAttribute($element, 'chart:vertical', 'Object 1/content.xml'));
     $this->assertFalse($pres->attributeElementExists($element, 'chart:three-dimensional', 'Object 1/content.xml'));
     $this->assertFalse($pres->attributeElementExists($element, 'chart:right-angled-axes', 'Object 1/content.xml'));
 }
Пример #2
0
 public function testLegend()
 {
     $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
     $oSeries->setShowSeriesName(true);
     $oLine = new Line();
     $oLine->addSeries($oSeries);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oChart = $oSlide->createChartShape();
     $oChart->getPlotArea()->setType($oLine);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:body/office:chart/chart:chart/chart:legend';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row/table:table-cell';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $element = '/office:document-content/office:body/office:chart/chart:chart/table:table/table:table-header-rows/table:table-row/table:table-cell[@office:value-type=\'string\']';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
 }
Пример #3
0
 public function testShowSeriesName()
 {
     $object = new Series();
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowSeriesName(true));
     $this->assertTrue($object->hasShowSeriesName());
     $this->assertInstanceOf('PhpOffice\\PhpPresentation\\Shape\\Chart\\Series', $object->setShowSeriesName(false));
     $this->assertFalse($object->hasShowSeriesName());
 }
Пример #4
0
function fnSlide_Scatter(PhpPresentation $objPHPPresentation)
{
    global $oFill;
    global $oShadow;
    // Create templated slide
    echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
    $currentSlide = createTemplatedSlide($objPHPPresentation);
    // local function
    // Generate sample data for fourth chart
    echo date('H:i:s') . ' Generate sample data for chart' . EOL;
    $seriesData = array('Monday' => 0.1, 'Tuesday' => 0.33333, 'Wednesday' => 0.4444, 'Thursday' => 0.5, 'Friday' => 0.4666, 'Saturday' => 0.3666, 'Sunday' => 0.1666);
    // Create a scatter chart (that should be inserted in a shape)
    echo date('H:i:s') . ' Create a scatter chart (that should be inserted in a chart shape)' . EOL;
    $lineChart = new Scatter();
    $series = new Series('Downloads', $seriesData);
    $series->setShowSeriesName(true);
    $lineChart->addSeries($series);
    // Create a shape (chart)
    echo date('H:i:s') . ' Create a shape (chart)' . EOL;
    $shape = $currentSlide->createChartShape();
    $shape->setName('PHPPresentation Daily Download Distribution')->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($lineChart);
    $shape->getView3D()->setRotationX(30);
    $shape->getView3D()->setPerspective(30);
    $shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
    $shape->getLegend()->getFont()->setItalic(true);
}
// Set Style
$oFill = new Fill();
$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFE06B20'));
$oShadow = new Shadow();
$oShadow->setVisible(true)->setDirection(45)->setDistance(10);
// Generate sample data for chart
echo date('H:i:s') . ' Generate sample data for chart' . EOL;
$seriesData = array('Monday' => 12, 'Tuesday' => 15, 'Wednesday' => 13, 'Thursday' => 17, 'Friday' => 14, 'Saturday' => 9, 'Sunday' => 7);
// Create templated slide
echo EOL . date('H:i:s') . ' Create templated slide' . EOL;
$currentSlide = createTemplatedSlide($objPHPPresentation);
// Create a line chart (that should be inserted in a shape)
echo date('H:i:s') . ' Create a line chart (that should be inserted in a chart shape)' . EOL;
$lineChart = new Line();
$series = new Series('Downloads', $seriesData);
$series->setShowSeriesName(true);
$series->setShowValue(true);
$lineChart->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($lineChart);
$shape->getView3D()->setRotationX(30);
$shape->getView3D()->setPerspective(30);
$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
Пример #6
0
 public function testTypeScatter()
 {
     $oSeries = new Series('Series', array('Jan' => 1, 'Feb' => 5, 'Mar' => 2));
     $oSeries->setShowSeriesName(true);
     $oScatter = new Scatter();
     $oScatter->addSeries($oSeries);
     $phpPresentation = new PhpPresentation();
     $oSlide = $phpPresentation->getActiveSlide();
     $oChart = $oSlide->createChartShape();
     $oChart->getPlotArea()->setType($oScatter);
     $pres = TestHelperDOCX::getDocument($phpPresentation, 'ODPresentation');
     $element = '/office:document-content/office:body/office:chart/chart:chart';
     $this->assertTrue($pres->elementExists($element, 'Object 1/content.xml'));
     $this->assertEquals('chart:scatter', $pres->getElementAttribute($element, 'chart:class', 'Object 1/content.xml'));
 }