16 self::DATASERIES_TYPE_STRING,
17 self::DATASERIES_TYPE_NUMBER,
94 $this->pointMarker = $marker;
122 if (!in_array(
$dataType, self::$dataTypeValues)) {
123 throw new Exception(
'Invalid datatype for chart data series values');
173 $this->pointMarker = $marker;
231 if (is_array($color)) {
232 foreach ($color as $colorValue) {
238 $this->fillColor = $color;
252 if (!preg_match(
'/^[a-f0-9]{6}$/i', $color)) {
253 throw new Exception(sprintf(
'Invalid hex color for chart series (color: "%s")', $color));
279 $this->lineWidth = max($minWidth, $width);
291 if (count($this->dataValues) > 0) {
292 return is_array(array_values($this->dataValues)[0]);
306 foreach ($this->dataValues as $dataValueSet) {
307 $levelCount = max($levelCount, count($dataValueSet));
330 $count = count($this->dataValues);
333 } elseif ($count == 1) {
334 return $this->dataValues[0];
357 if ($this->dataSource !== null) {
360 $calcEngine->_calculateFormulaValue(
361 '=' . $this->dataSource,
363 $worksheet->getCell(
'A1')
368 foreach ($this->dataValues as &$dataValue) {
369 if (is_string($dataValue) && !empty($dataValue) && $dataValue[0] ==
'#') {
377 if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
380 $newArray = array_values(array_shift($newDataValues));
381 foreach ($newArray as
$i => $newDataSet) {
382 $newArray[
$i] = [$newDataSet];
385 foreach ($newDataValues as $newDataSet) {
387 foreach ($newDataSet as $newDataVal) {
388 array_unshift($newArray[
$i++], $newDataVal);
391 $this->dataValues = $newArray;
394 $this->pointCount = count($this->dataValues);
getDataType()
Get Series Data Type.
validateColor($color)
Method for validating hex color.
setDataType($dataType)
Set Series Data Type.
static extractSheetTitle($pRange, $returnRange=false)
Extract worksheet title from range.
getDataValue()
Get the first Series Data value.
getPointCount()
Get Series Point Count.
const DATASERIES_TYPE_STRING
setFormatCode($formatCode)
Set Series Format Code.
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
const DATASERIES_TYPE_NUMBER
__construct($dataType=self::DATASERIES_TYPE_NUMBER, $dataSource=null, $formatCode=null, $pointCount=0, $dataValues=[], $marker=null, $fillColor=null)
Create a new DataSeriesValues object.
getFillColor()
Get fill color.
refresh(Worksheet $worksheet, $flatten=true)
setLineWidth($width)
Set line width for the series.
getLineWidth()
Get line width for series.
setDataValues($dataValues)
Set Series Data Values.
setDataSource($dataSource)
Set Series Data Source (formula).
static unwrapResult($value)
Remove quotes used as a wrapper to identify string values.
static getInstance(?Spreadsheet $spreadsheet=null)
Get an instance of this class.
getFormatCode()
Get Series Format Code.
setPointMarker($marker)
Set Point Marker.
multiLevelCount()
Return the level count of a multi-level Data Series.
isMultiLevelSeries()
Identify if the Data Series is a multi-level or a simple series.
getDataSource()
Get Series Data Source (formula).
getDataValues()
Get Series Data Values.
static rangeDimension($pRange)
Calculate range dimension.
getPointMarker()
Get Point Marker.
setFillColor($color)
Set fill color for series.