Source for file SeriesCollection.php
Documentation is available at SeriesCollection.php
* Description: The SeriesCollection class, a collection of Series objects,
* is manipulated via the TChart TChart.getSeries() method.
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
private $arrayList = array();
private $applyZOrder = true;
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
public function add(Class type) throws InstantiationException,
return add((Series) (type.newInstance()));
public function add($type) {
return $this->add($type->newInstance());
* Adds a new Series instance to Chart.
* @param s Series The Series instance to add.
* @return Series The same Series.
public function add($s) {
parent::offsetset(sizeof($this),$s);
// TODO $this->chart->broadcastEvent($s, SeriesEventStyle.ADD);
// TODO remove, but adding series throught delphi ide does not
// save the chart property into the object
$this->chart= $s->getChart();
if (!($s->getChart() === $this->chart)) {
$s->setChart($this->chart);
return parent::offsetget($index);
parent::offsetset($index,$value);
public function insert($index, $s) {
public function moveTo($s, $index) {
$tmp = $this->get($index);
* Returns the corresponding point index which has the specified Value.
for ($t = 0; $t < $this->count(); $t++ ) {
for ($t = 0; $t < sizeof($this); $t++ ) {
if ($s->toString()->equals($title)) {
* Deletes the specified Series from the Chart list of series.
// TODO $this->chart->broadcastEvent($s, SeriesEventStyle.REMOVE);
for ($i= 0;$i< sizeof($tmpArray);$i++ )
// TODO $this->chart->invalidate();
* Removes all Series from the Chart but does not dispose of (destroy)
* Changes the Series order, swapping one Series Z position with another.<br>
* The Chart repaints to reflect the new Series order. <br>
* It accesses TChart.SeriesList method.
public function exchange($series1, $series2) {
// TODO $this->chart->broadcastEvent(null, SeriesEventStyle.SWAP);
$this->chart->invalidate();
* Removes (and optionally disposes) all Series.
public function clear($dispose= true) {
foreach($this as $key=> $item)
// TODO review parent::offsetUnset($key);
/* TODO review - This cannot be done due to the php bug (does not
serialize fine the classes which extends from ArrayObject, it does
not serializes the properties. This has been fixed in php 5.3.
$this->arrayList->clear();
$this->chart->invalidate();
// $this->chart->broadcastEvent(null, SeriesEventStyle.REMOVEALL);
* Defines the Chart component.
for ($t = 0; $t < sizeof($this); $t++ ) {
* Sets multiple Series on same Chart in different Z spaces when true.<br>
* It's valid only when TChart.View3D is true and when there's more than
* one Series in the same chart.<br>
* When false, all Series are drawn using the full Chart Z space. The
* Chart output can be confusing if Series overlap. <br>
return $this->applyZOrder;
* Sets multiple Series on same Chart in different Z spaces when true.<br>
$this->applyZOrder = $value;
if ($this->chart != null) {
$this->chart->invalidate();
* Adds the specified NumValues random points to all series in the collection.
* @param numValues int the number of sample values to add.
for ($t = 0; $t < sizeof($this); $t++ ) {
$this->getSeries($t)->fillSampleValues($numValues);
for ($t = 0; $t < sizeof($this); $t++ ) {
|