Source for file FastLine.php
Documentation is available at FastLine.php
* Description: The FastLine Series is an extremely simple Series component
* that draws its points as fast as possible
* @copyright Copyright (c) 1995-2010 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
private $autoRepaint = true;
private $invertedStairs= false;
private $ignoreNulls = true;
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
//pLinePen.ColorChanged=linePenColorChanged;
* Repaints Chart after any changes are made.<br>
* Use AutoRepaint false to disable Chart repainting whilst, for example,
* adding a large number of points to a FastLine Series. This avoids
* repainting of the Chart whilst the points are added.<br>
* AutoRepaint may be re-enabled, followed by a manual Repaint command
* when all points are added. <br>
return $this->autoRepaint;
* Repaints Chart after any changes are made.<br>
$this->autoRepaint = $value;
//private void linePenColorChanged(Object o, EventArgs e) {
// setColor(pLinePen.getColor());
private function prepareCanvas($g= null) {
$g= $this->chart->getGraphics3D();
$g->getPen()->setColor($this->getColor());
* The Transparency of the FastLine series as a percentage.
* Sets the Transparency of the FastLine series as a percentage.
* When false, it only draws the first point at any X pixel location.
* The option offers speed gains if large numbers of point repetitions
* occur at one X location. <br>
* When false, it only draws the first point at any X pixel location.
* The option offers speed gains if large numbers of point repetitions
* occur at one X location. <br>
* Default value: true<br>
* <pre><font face="Courier" size="4">
* lineSeries.setDrawAllPoints( false );
parent::setColor($value);
* Returns the ValueIndex of the "clicked" point in the Series.<br>
* Clicked means the X and Y coordinates are in the point screen region
* bounds. If no point is "touched", Clicked returns -1 <br>
if ($this->chart != null) {
$p = $this->chart->getGraphics3D()->calculate2DPosition($x, $y, $this->getMiddleZ());
if (($tmpX == $x) && ($tmpY == $y)) { // $on $this->point
$this->MathUtils->pointInLineTolerance($p, $tmpX, $tmpY, $oldX, $oldY,
private function calcPosition($index) {
protected function draw() {
$this->old = $this->calcPosition(($tmp > 0) ? $tmp - 1 : 0);
$this->internalG = $this->chart->getGraphics3D();
$this->internal3D = $this->chart->getAspect()->getView3D();
$this->doMove($this->old);
private function doMove($p) {
$this->internalG->moveToZ($p, $this->middleZ);
$this->internalG->moveTo($p);
* Called internally. Draws the "ValueIndex" point of the Series.
$p = $this->calcPosition($index);
if ($this->internalG == null) {
$this->internalG = $this->chart->getGraphics3D();
if ($p->getX() == $this->old->getX()) {
if ((!$this->drawAll) || ($p->getY() == $this->old->getY())) {
$tmpColor = new Color(0,0,0,255); // TODO check transparent
if ($this->getValueColor($index) != $tmpColor/*->TRANSPARENT*/) {
return; // $FastLine $this->Nulls
if ($this->ignoreNulls || ($this->getValueColor($index) != new Color(0,0,0,255))) { // $FastLine $Nulls
$this->internalG->getPen()->setColor($this->getValueColor($index));
if ($this->invertedStairs) {
$this->internalG->___lineTo($this->old->getX(), $p->getY(), $this->middleZ);
$this->internalG->___lineTo($p->getX(), $this->old->getY(), $this->middleZ);
$this->internalG->lineTo($p, $this->middleZ);
if ($this->invertedStairs) {
$this->internalG->_____lineTo($this->old->getX(), $p->getY());
$this->internalG->_____lineTo($p->getX(), $this->old->getY());
$this->internalG->__lineTo($p);
} else { // $FastLine $Nulls
if ($index + 1 < $getCount()) {
$this->doMove($this->calcPosition($index + 1));
// if (colorEach) internalG.getPen().Color=getValueColor(index);
// internalG.LineTo(X,Y,middleZ);
// internalG.LineTo(X,Y);
// if (colorEach) internalG.getPen().Color=getValueColor(index);
// internalG.LineTo(X,Y,middleZ);
// internalG.LineTo(X,Y);
$this->old->setX($p->getX());
$this->old->setY($p->getY());
protected function drawMark($valueIndex, $st, $aPosition) {
$this->getMarks()->applyArrowLength($aPosition);
parent::drawMark($valueIndex, $st, $aPosition);
$this->prepareCanvas($g);
$g->horizontalLine($rect->x, $rect->getRight(),
($rect->y + $rect->getBottom()) / 2);
parent::createSubGallery($addSubChart);
* Controls the drawing of FastLine series. <br>
* In most normal situations, a series draws a line between each Line
* point. This makes the Line appear as a "mountain" shape. <br>
* However, setting Stairs to true will make the Series to draw 2 Lines
* between each pair of points, thus giving a "stairs" appearance. <br>
* This is most used in some financial Chart representations. <br>
* When Stairs is set to true you may set InvertedStairs to true to alter
* the direction of the step. <br>
* Controls the drawing of FastLine series. <br>
* Default value: false<br>
* <pre><font face="Courier" size="4">
* lineSeries1.setStairs( true );
* Controls the FastLine series drawing. <br>
* When Stairs is set to true you may set InvertedStairs to true to alter
* the direction of the step. <br>
* In most normal situations, the Series draws a line between each Line
* point. This makes the Line appear as a "mountain" shape. <br>
* However, setting Stairs to true will make the Series draw 2 Lines
* between each pair of points, thus giving a "stairs" appearance. <br>
* This is most used in some financial Chart representations. You may
* invert the stair by setting InvertedStairs to true. <br>
return $this->invertedStairs;
* Controls the FastLine series drawing. <br>
* Displays null points when false<br>
* For speed reasons, FastLine series supports null (empty) values only
* when IgnoreNulls is false. <br>
* By default all points are displayed (IgnoreNulls is true by default).<br>
* To enable FastLine series to hide null points, set IgnoreNulls to
return $this->ignoreNulls;
* Displays null points when false<br>
* Default value: true<br>
* <pre><font face="Courier" size="4">
* lineSeries1.setNull( 123 ); // -- make null (empty) point index 123
* lineSeries1.setIgnoreNulls( false ); // -- allow null points
* lineSeries1.setStairs( true ); // -- set "stairs" mode
* <p>Title: BaseLine class</p>
* <p>Description: Abstract Series class inherited by a number of TeeChart
* <p>Copyright (c) 2005-2007 by Steema Software SL. All Rights
* <p>Company: Steema Software SL</p>
/* todo remove ... baseline class done in separate class unit
class BaseLine extends Series {
protected function BaseLine($c=null) {
public function assign($source) {
if ($source instanceof BaseLine) {
if ($this->tmp->linePen != null) {
$this->getLinePen()->assign($this->tmp->linePen);
public function setChart($c) {
$this->getLinePen()->setChart($this->chart);
* Determines pen to draw the line connecting all points.<br>
public function getLinePen() {
if ($this->linePen == null) {
$this->linePen = new ChartPen($this->chart, $tmpColor->EMPTY);
|