Last active
March 11, 2022 06:57
-
-
Save userneeds-ahe/80b008ceeaa2abc85f97eaed24dcae3e to your computer and use it in GitHub Desktop.
createChartSeries
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// file: https://filebin.net/tgroei6wb1fbn48s | |
namespace Userneeds\Reporting\Services\Powerpoint\Aspose; | |
use Aspose\Slides\Cloud\Sdk\Api\SlidesApi; | |
use Aspose\Slides\Cloud\Sdk\Model\OneValueChartDataPoint; | |
use Aspose\Slides\Cloud\Sdk\Model\OneValueSeries; | |
class Chart extends AsposeApi | |
{ | |
protected $api; | |
/** | |
* Add series to slide chart at index | |
* @param string $file_name | |
* @param int $slideIndex | |
* @param array $values | |
* @param int $chartIndex | |
* @return int The final series count. | |
* @throws \Aspose\Slides\Cloud\Sdk\Api\ApiException | |
*/ | |
public function addChartSeries( | |
string $file_name, | |
// array $values, | |
int $slideIndex, | |
int $chartIndex = 0, | |
int $seriesIndex = null | |
): int { | |
// Override | |
$this->api = new SlidesApi(); | |
$slideIndex = 2; | |
$values = [11, 12, 13]; | |
$dto = new OneValueSeries(); | |
$dataPoints = []; | |
foreach ($values as $value) { | |
$dataPoint = new OneValueChartDataPoint(); | |
$dataPoint->setValue($value); | |
$dataPoints[] = $dataPoint; | |
} | |
$dto->setDataPoints($dataPoints); | |
$result = $this->api()->createChartSeries($file_name, $slideIndex, $chartIndex, $dto); | |
return count($result->getSeries()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment