How do I customize the line in a line chart with PHPPowerpoint/PHPPresentation?

非 Y 不嫁゛ 提交于 2019-12-31 06:00:20

问题


How do I customize the lines in the line charts on PHPPowerpoint/PHPPresentation? I can't find anything in there documentation or in the samples to figure this out.

Here's my code:

$seriesData = array(
    'Monday' => 12,
    'Tuesday' => 15,
    'Wednesday' => 13,
    'Thursday' => 17,
    'Friday' => 14,
    'Saturday' => 9,
    'Sunday' => 7
);

$lineChart = new Line();
$series = new Series('Downloads', $seriesData);
$series->setShowSeriesName(false);
$series->setShowValue(false);
$series->setShowLeaderLines(false);

$lineChart->addSeries($series);

$shape = $currentSlide->createChartShape();
$shape->setResizeProportional(false)->setHeight(convertIn2Px(2.28))->setWidth(convertIn2Px(5.09))->setOffsetX(convertIn2Px(4.75))->setOffsetY(convertIn2Px(3.9));
$shape->getTitle()->setVisible(false);
$shape->getPlotArea()->setType($lineChart);
$shape->getPlotArea()->getAxisY()->setFormatCode('#,##0');
$shape->getLegend()->setVisible(false);

The color of the line graph comes up in blue but I would like to be able to change that color. It also shows the square markers but I would like to make it so that there are no markers on the line.

Thank you in advanced.


回答1:


It's actually in the develop branch.

But you can do this :

$oOutline = new \PhpOffice\PhpPresentation\Style\Outline();
$oOutline->getFill()->setFillType(Fill::FILL_SOLID);
$oOutline->getFill()->setStartColor(new Color(Color::COLOR_YELLOW));
$oOutline->setWidth(2);

$series->setOutline($oOutline);


来源:https://stackoverflow.com/questions/34345240/how-do-i-customize-the-line-in-a-line-chart-with-phppowerpoint-phppresentation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!