Source for file ValueList.php
Documentation is available at ValueList.php
* Description: Array to hold Series data point values
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
// "name" should not be transient, as it can be the "valueSource"
// (setDataMember) of another series source. So it must be serialized.
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
public function ValueList($s, $name, $initialCapacity=- 1) {
if ($initialCapacity==- 1) {
// TODO review before $this->value = new double[1];
parent::__construct(null);
$this->series->valuesListAdd($this);
* Field to use as source for this value list.<br>
* Field to use as source for this value list.<br>
$this->series->checkDataSource();
* Allows values to be expressed either as numbers or as Date+Time
* Each Series value list has a boolean property called DateTime. The
* boolean DateTime method tells TeeChart what type the numbers are. The
* horizontal (x axis) and vertical (y axis) value defaults are number
* format (DateTime False). DateTime can be changed both at design-time and
* run-time, forcing the Chart to repaint. It used whenever a value must be
* converted to text, for example, to draw it as the chart axis labels.
* Axis labels will be drawn in DateTime or numeric format accordingly to
* the setting of the DateTime method. <br><br>
* You can also set the Chart Series ValueFormat and the Chart Axis
* DateTimeFormat formatting strings, to control how the values will be
* Allows values to be expressed either as numbers or as Date+Time
* Determines if points are automatically sorted or left at original
* position.<br> Runtime only. <br>
* This Order is used by default by the Series XValues to draw lines from
* Left to Right. Setting the XValues.Order property to loNone will respect
* the points order at point creation. This can be used to draw polygons.
* <br>Default value: None
* Determines if points are automatically sorted or left at original
* position.<br> Runtime only. <br>
* @param value ValueListOrder
if ($this->order != $value) {
//DB: Removed as it breaks series initialization at design-time,
//when changing series order it'll call fillSampleValues.
// series.checkDataSource();
* Returns the name of this ValueList.
* The Name property can be used to link series when using functions.
* You can link one series ValueList to another series list, by using
* the setDataMember method.
* mySeries.setDataSource( myCandle );
* mySeries.getYValues().setDataMember(myCandle.getHighValues().getName());
* Returns the name of this ValueList.
* The "Name" property is used as the "dataMember" of other series
* when they are linked through functions.
* Removes all values in the list.
* Warning: You should not call this "clear" method directly.
* Call the series "clear" method instead.
public function clear() {
$this->value = Array(); // todo review new double[1];
* Returns the corresponding point index which has the specified Value.<br>
* You can use it for example to obtain X co-ordinates based on Y values, or
if ($this->value[$t] == $value) {
for ( $t = $index; $t < $this->count; $t++ ) {
* Re-orders Series points, interchanging their position in the Series
* By default, Series are set to sort points in ascending order using their
* X coordinates. This is accomplished with this code: <br><br>
* tChart1.getSeries(0).getXValues().setOrder( loAscending )<br>
* tChart1.getSeries(0).getYValues().setOrder( loNone )<br><br>
* By default, Series draw points using the point ValueIndex, except in
* some non common situations like having the horizontal axis inverted.<br>
* <b>Important Note:</b> Re-Ordering Series points do NOT change point
* X coordinates. Series points which have no X coordinates are assigned a
* unique incremental number to determine the point horizontal positions.
* Automatic Point indexes start at zero. You will need to change every
* point X coordinate when sorting Series points with automatic X values.
$this->Utils->sort(0, $this->count - 1,
$this->series->getValueIndexSwapper()
// Eliminates excess of empty values in array.
// (Array always contains Count plus some more empty values to
// reduce overhead expanding the array each time a new value is added).
/*double[]*/ $newValue = array(); // todo review double[$this->count];
$this->System->arraycopy($this->value,0,$this->newValue,0,$this->count);
for (int t = 0; t < count; t++) {
$this->value = $this->newValue;
* Returns the First point value.
for ($t = $this->count - 1; $t > $valueIndex; $t-- ) {
$this->value[$valueIndex] = $value;
* Returns the Last point value.<br>
* This is the same value as the Count - 1 index value:
* Obsolete. Please use IndexOf method instead.
public function locate($value) {
public function assign($value) {
$this->order = $value->order;
$this->name = $value->name;
private function calcStats() {
// todo review before - for $t = 1....
for ( $t = 1; $t < $this->count; $t++ ) {
* The highest of all values in the list.<br>
* As new points are being added to Series, the IValueList object
* calculates the Maximum, Minimum and TotalABS properties. <br>
* This applies to all Series lists of values, such as XValues, YValues,
* Obsolete. Please use Maximum method instead.
* Obsolete. Please use Minimum instead.
* The lowest of all values in the list.<br>
* @see ValueList#getMaximum
* The sum of all IValueList values.<br>
* When adding, deleting or modifying point values using the right methods,
* Total is automatically incremented and decremented. <br>
* Total is used by some Functions to improve speed when performing
* calculations against point values, where having already calculated
* the sum of point values is necessary. <br>
* The sum of all absolute values in the list.<br>
* Run-time and read only. <br>
* The values are first converted to their absolute value.<br>
* Pie series, for example, uses this property to calculate the percent
* each Pie slice represents. <br>
* @see ValueList#getMaximum
//set { totalABS=value; } // TODO: How to avoid Pie series setting ?
return $this->value[$index];
public function setValue($index, $value) {
$this->value[$index] = $value;
return new DateTime($this->value[$index]);
private function incrementArray() {
if ($this->count > $tmp) {
$tmp += $this->count / 4;
/*double[]*/ $newValue = array(); //todo review new double[$tmp];
// TODO Review before System->arraycopy($this->value,0,newValue,0,$this->count-1);
$this->value = $newValue;
$this->value[$result] = $value;
($value >= $this->value[$t])) ||
($value <= $this->value[$t]))) {
$this->value[$result] = $value;
while (($t >= 0) && ($this->value[$t] > $value)) {
while (($t >= 0) && ($this->value[$t] < $value)) {
for ($t = ($this->count - 1); $t > ($result); $t-- ) {
$this->value[$result] = $value;
* Renumbers all values in a ValueList class starting at zero.<br>
* <b>Warning:</b> Calling fillSequence removes any previous value in a
* Use fillSequence when deleting points at runtime.
for ( $t = 0; $t < $this->count; $t++ ) {
public function exchange($index1, $index2) {
$this->value[$index2] = $this->tmp;
/* TODO class CompareValueIndex implements Comparator {
public function compare($a, $b) {
$result = ($this->value[$a] < $this->value[$b]) ? -1 :
($this->value[$a] > $this->value[$b]) ? 1 : 0;
if ($this->order == ValueListOrder::$DESCENDING) {
|