0

我正在使用PHPPowerPoint导出.ppt文件,使用PHP. 到目前为止,当我想从条形图中删除图例时,我是成功的。

生成条形图的代码是:

$chart1 = new Bar();
$series = new Series('City Distribution', $timeseries);
$series->setShowSeriesName(false);
$series->setShowValue(true);
$series->getFill()->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FF1dd2af'));

$chart1->addSeries($series);


$gFill =  new Fill();
$gFill->setFillType(Fill::FILL_GRADIENT_PATH)->setRotation(90)->setStartColor(new Color( 'FF1dd2af' ))->setEndColor(new Color( 'FFFFFFFF' ));

$oFill = new Fill();
$oFill->setFillType(Fill::FILL_SOLID)->setStartColor(new Color('FFFFFFFF'));

$oShadow = new Shadow();
$oShadow->setVisible(true)->setDirection(45)->setDistance(10);

// Create a shape (chart)
$shape = $currentSlide->createChartShape();
//$shape->getAlignment()->setVertical( Alignment::VERTICAL_TOP );
$shape->getTitle()->setVisible(false);
$shape->setName('City Distribution')->setResizeProportional(false)->setHeight(300)->setWidth(250)->setOffsetX(25)->setOffsetY(200);
$shape->setFill($oFill);
$shape->getTitle()->setText('City Distribution');
$shape->getTitle()->getFont()->setItalic(true);
$shape->getPlotArea()->getAxisX()->setTitle('City');
$shape->getPlotArea()->getAxisY()->setTitle('Number of Users');
$shape->getPlotArea()->setType($chart1);
$shape->getLegend()->getBorder()->setLineStyle(Border::LINE_SINGLE);
$shape->getLegend()->getFont()->setItalic(true);

这工作得很好,但它放置了一个图例框,我想删除它。任何想法?

4

1 回答 1

2

没关系,我自己想通了,你需要做的就是:

$shape->getLegend()->setVisible(false);

把它放在线下面

$shape->getTitle()->setVisible(false);
于 2016-01-28T06:17:16.730 回答