ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
PHPExcel_Chart_DataSeriesValues Class Reference
+ Collaboration diagram for PHPExcel_Chart_DataSeriesValues:

Public Member Functions

 __construct ($dataType=self::DATASERIES_TYPE_NUMBER, $dataSource=null, $formatCode=null, $pointCount=0, $dataValues=array(), $marker=null)
 Create a new PHPExcel_Chart_DataSeriesValues object. More...
 
 getDataType ()
 Get Series Data Type. More...
 
 setDataType ($dataType=self::DATASERIES_TYPE_NUMBER)
 Set Series Data Type. More...
 
 getDataSource ()
 Get Series Data Source (formula) More...
 
 setDataSource ($dataSource=null, $refreshDataValues=true)
 Set Series Data Source (formula) More...
 
 getPointMarker ()
 Get Point Marker. More...
 
 setPointMarker ($marker=null)
 Set Point Marker. More...
 
 getFormatCode ()
 Get Series Format Code. More...
 
 setFormatCode ($formatCode=null)
 Set Series Format Code. More...
 
 getPointCount ()
 Get Series Point Count. More...
 
 isMultiLevelSeries ()
 Identify if the Data Series is a multi-level or a simple series. More...
 
 multiLevelCount ()
 Return the level count of a multi-level Data Series. More...
 
 getDataValues ()
 Get Series Data Values. More...
 
 getDataValue ()
 Get the first Series Data value. More...
 
 setDataValues ($dataValues=array(), $refreshDataSource=TRUE)
 Set Series Data Values. More...
 
 refresh (PHPExcel_Worksheet $worksheet, $flatten=TRUE)
 

Data Fields

const DATASERIES_TYPE_STRING = 'String'
 
const DATASERIES_TYPE_NUMBER = 'Number'
 

Private Member Functions

 _stripNulls ($var)
 

Private Attributes

 $_dataType = null
 
 $_dataSource = null
 
 $_formatCode = null
 
 $_marker = null
 
 $_pointCount = 0
 
 $_dataValues = array()
 

Static Private Attributes

static $_dataTypeValues
 

Detailed Description

Definition at line 36 of file DataSeriesValues.php.

Constructor & Destructor Documentation

◆ __construct()

PHPExcel_Chart_DataSeriesValues::__construct (   $dataType = self::DATASERIES_TYPE_NUMBER,
  $dataSource = null,
  $formatCode = null,
  $pointCount = 0,
  $dataValues = array(),
  $marker = null 
)

Create a new PHPExcel_Chart_DataSeriesValues object.

Definition at line 92 of file DataSeriesValues.php.

References setDataType().

93  {
94  $this->setDataType($dataType);
95  $this->_dataSource = $dataSource;
96  $this->_formatCode = $formatCode;
97  $this->_pointCount = $pointCount;
98  $this->_dataValues = $dataValues;
99  $this->_marker = $marker;
100  }
setDataType($dataType=self::DATASERIES_TYPE_NUMBER)
Set Series Data Type.
+ Here is the call graph for this function:

Member Function Documentation

◆ _stripNulls()

PHPExcel_Chart_DataSeriesValues::_stripNulls (   $var)
private

Definition at line 276 of file DataSeriesValues.php.

276  {
277  return $var !== NULL;
278  }

◆ getDataSource()

PHPExcel_Chart_DataSeriesValues::getDataSource ( )

Get Series Data Source (formula)

Returns
string

Definition at line 136 of file DataSeriesValues.php.

References $_dataSource.

◆ getDataType()

PHPExcel_Chart_DataSeriesValues::getDataType ( )

Get Series Data Type.

Returns
string

Definition at line 107 of file DataSeriesValues.php.

References $_dataType.

107  {
108  return $this->_dataType;
109  }

◆ getDataValue()

PHPExcel_Chart_DataSeriesValues::getDataValue ( )

Get the first Series Data value.

Returns
mixed

Definition at line 246 of file DataSeriesValues.php.

References $_dataValues.

246  {
247  $count = count($this->_dataValues);
248  if ($count == 0) {
249  return null;
250  } elseif ($count == 1) {
251  return $this->_dataValues[0];
252  }
253  return $this->_dataValues;
254  }

◆ getDataValues()

PHPExcel_Chart_DataSeriesValues::getDataValues ( )

Get Series Data Values.

Returns
array of mixed

Definition at line 237 of file DataSeriesValues.php.

References $_dataValues.

◆ getFormatCode()

PHPExcel_Chart_DataSeriesValues::getFormatCode ( )

Get Series Format Code.

Returns
string

Definition at line 182 of file DataSeriesValues.php.

References $_formatCode.

◆ getPointCount()

PHPExcel_Chart_DataSeriesValues::getPointCount ( )

Get Series Point Count.

Returns
integer

Definition at line 203 of file DataSeriesValues.php.

References $_pointCount.

◆ getPointMarker()

PHPExcel_Chart_DataSeriesValues::getPointMarker ( )

Get Point Marker.

Returns
string

Definition at line 161 of file DataSeriesValues.php.

References $_marker.

161  {
162  return $this->_marker;
163  }

◆ isMultiLevelSeries()

PHPExcel_Chart_DataSeriesValues::isMultiLevelSeries ( )

Identify if the Data Series is a multi-level or a simple series.

Returns
boolean

Definition at line 212 of file DataSeriesValues.php.

212  {
213  if (count($this->_dataValues) > 0) {
214  return is_array($this->_dataValues[0]);
215  }
216  return null;
217  }

◆ multiLevelCount()

PHPExcel_Chart_DataSeriesValues::multiLevelCount ( )

Return the level count of a multi-level Data Series.

Returns
boolean

Definition at line 224 of file DataSeriesValues.php.

224  {
225  $levelCount = 0;
226  foreach($this->_dataValues as $dataValueSet) {
227  $levelCount = max($levelCount,count($dataValueSet));
228  }
229  return $levelCount;
230  }

◆ refresh()

PHPExcel_Chart_DataSeriesValues::refresh ( PHPExcel_Worksheet  $worksheet,
  $flatten = TRUE 
)

Definition at line 280 of file DataSeriesValues.php.

References $i, PHPExcel_Calculation\_unwrapResult(), array, PHPExcel_Calculation_Functions\flattenArray(), PHPExcel_Worksheet\getCell(), PHPExcel_Calculation\getInstance(), PHPExcel_Worksheet\getParent(), and PHPExcel_Cell\rangeDimension().

280  {
281  if ($this->_dataSource !== NULL) {
282  $calcEngine = PHPExcel_Calculation::getInstance($worksheet->getParent());
283  $newDataValues = PHPExcel_Calculation::_unwrapResult(
284  $calcEngine->_calculateFormulaValue(
285  '='.$this->_dataSource,
286  NULL,
287  $worksheet->getCell('A1')
288  )
289  );
290  if ($flatten) {
291  $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
292  foreach($this->_dataValues as &$dataValue) {
293  if ((!empty($dataValue)) && ($dataValue[0] == '#')) {
294  $dataValue = 0.0;
295  }
296  }
297  unset($dataValue);
298  } else {
299  $cellRange = explode('!',$this->_dataSource);
300  if (count($cellRange) > 1) {
301  list(,$cellRange) = $cellRange;
302  }
303 
304  $dimensions = PHPExcel_Cell::rangeDimension(str_replace('$','',$cellRange));
305  if (($dimensions[0] == 1) || ($dimensions[1] == 1)) {
306  $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($newDataValues);
307  } else {
308  $newArray = array_values(array_shift($newDataValues));
309  foreach($newArray as $i => $newDataSet) {
310  $newArray[$i] = array($newDataSet);
311  }
312 
313  foreach($newDataValues as $newDataSet) {
314  $i = 0;
315  foreach($newDataSet as $newDataVal) {
316  array_unshift($newArray[$i++],$newDataVal);
317  }
318  }
319  $this->_dataValues = $newArray;
320  }
321  }
322  $this->_pointCount = count($this->_dataValues);
323  }
324 
325  }
static rangeDimension($pRange='A1:A1')
Calculate range dimension.
Definition: Cell.php:741
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
Definition: Functions.php:598
getCell($pCoordinate='A1')
Get cell at a specific coordinate.
Definition: Worksheet.php:1153
getParent()
Get parent.
Definition: Worksheet.php:786
Create styles array
The data for the language used.
static getInstance(PHPExcel $workbook=NULL)
Get an instance of this class.
static _unwrapResult($value)
Remove quotes used as a wrapper to identify string values.
$i
Definition: disco.tpl.php:19
+ Here is the call graph for this function:

◆ setDataSource()

PHPExcel_Chart_DataSeriesValues::setDataSource (   $dataSource = null,
  $refreshDataValues = true 
)

Set Series Data Source (formula)

Parameters
string$dataSource
Returns
PHPExcel_Chart_DataSeriesValues

Definition at line 146 of file DataSeriesValues.php.

146  {
147  $this->_dataSource = $dataSource;
148 
149  if ($refreshDataValues) {
150  // TO DO
151  }
152 
153  return $this;
154  }

◆ setDataType()

PHPExcel_Chart_DataSeriesValues::setDataType (   $dataType = self::DATASERIES_TYPE_NUMBER)

Set Series Data Type.

Parameters
string$dataTypeDatatype of this data series Typical values are: PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING Normally used for axis point values PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER Normally used for chart data values
Returns
PHPExcel_Chart_DataSeriesValues

Definition at line 122 of file DataSeriesValues.php.

Referenced by __construct(), and DataSeriesValuesTest\testGetDataType().

122  {
123  if (!in_array($dataType, self::$_dataTypeValues)) {
124  throw new PHPExcel_Chart_Exception('Invalid datatype for chart data series values');
125  }
126  $this->_dataType = $dataType;
127 
128  return $this;
129  }
+ Here is the caller graph for this function:

◆ setDataValues()

PHPExcel_Chart_DataSeriesValues::setDataValues (   $dataValues = array(),
  $refreshDataSource = TRUE 
)

Set Series Data Values.

Parameters
array$dataValues
boolean$refreshDataSourceTRUE - refresh the value of _dataSource based on the values of $dataValues FALSE - don't change the value of _dataSource
Returns
PHPExcel_Chart_DataSeriesValues

Definition at line 265 of file DataSeriesValues.php.

References PHPExcel_Calculation_Functions\flattenArray().

265  {
266  $this->_dataValues = PHPExcel_Calculation_Functions::flattenArray($dataValues);
267  $this->_pointCount = count($dataValues);
268 
269  if ($refreshDataSource) {
270  // TO DO
271  }
272 
273  return $this;
274  }
static flattenArray($array)
Convert a multi-dimensional array to a simple 1-dimensional array.
Definition: Functions.php:598
+ Here is the call graph for this function:

◆ setFormatCode()

PHPExcel_Chart_DataSeriesValues::setFormatCode (   $formatCode = null)

Set Series Format Code.

Parameters
string$formatCode
Returns
PHPExcel_Chart_DataSeriesValues

Definition at line 192 of file DataSeriesValues.php.

192  {
193  $this->_formatCode = $formatCode;
194 
195  return $this;
196  }

◆ setPointMarker()

PHPExcel_Chart_DataSeriesValues::setPointMarker (   $marker = null)

Set Point Marker.

Parameters
string$marker
Returns
PHPExcel_Chart_DataSeriesValues

Definition at line 171 of file DataSeriesValues.php.

171  {
172  $this->_marker = $marker;
173 
174  return $this;
175  }

Field Documentation

◆ $_dataSource

PHPExcel_Chart_DataSeriesValues::$_dataSource = null
private

Definition at line 59 of file DataSeriesValues.php.

Referenced by getDataSource().

◆ $_dataType

PHPExcel_Chart_DataSeriesValues::$_dataType = null
private

Definition at line 52 of file DataSeriesValues.php.

Referenced by getDataType().

◆ $_dataTypeValues

PHPExcel_Chart_DataSeriesValues::$_dataTypeValues
staticprivate
Initial value:
self::DATASERIES_TYPE_STRING,
self::DATASERIES_TYPE_NUMBER,
)

Definition at line 42 of file DataSeriesValues.php.

◆ $_dataValues

PHPExcel_Chart_DataSeriesValues::$_dataValues = array()
private

Definition at line 87 of file DataSeriesValues.php.

Referenced by getDataValue(), and getDataValues().

◆ $_formatCode

PHPExcel_Chart_DataSeriesValues::$_formatCode = null
private

Definition at line 66 of file DataSeriesValues.php.

Referenced by getFormatCode().

◆ $_marker

PHPExcel_Chart_DataSeriesValues::$_marker = null
private

Definition at line 73 of file DataSeriesValues.php.

Referenced by getPointMarker().

◆ $_pointCount

PHPExcel_Chart_DataSeriesValues::$_pointCount = 0
private

Definition at line 80 of file DataSeriesValues.php.

Referenced by getPointCount().

◆ DATASERIES_TYPE_NUMBER

const PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_NUMBER = 'Number'

Definition at line 40 of file DataSeriesValues.php.

◆ DATASERIES_TYPE_STRING

const PHPExcel_Chart_DataSeriesValues::DATASERIES_TYPE_STRING = 'String'

Definition at line 39 of file DataSeriesValues.php.


The documentation for this class was generated from the following file: