Source for file ColorLine.php
Documentation is available at ColorLine.php
* Description: Color Line tool. To draw custom lines at a axis value
* @copyright (c) 1995-2008 by Steema Software SL. All Rights Reserved. <info@steema.com>
* @link http://www.steema.com
private $allowDrag = true;
private $dragRepaint = false;
private $noLimitDrag = false;
private $drawBehind = false;
private $dragging = false;
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
$this->listenerList->remove($this->DragListener->class , $l);
* Default value: ColorLineStyle.CUSTOM
* Default value: ColorLine.CUSTOM
* @param value ColorLineStyle
if($this->style != $value)
return $this->iAxis->getMaximum();
return($this->iAxis->getMaximum() + $this->iAxis->getMinimum()) * 0 . 5;
return $this->iAxis->getMinimum();
private function drawColorLine($back)
$g = $this->chart->getGraphics3D();
$r = $this->chart->getChartRect();
if(!$g->getPen()->getVisible())
$tmpColor = new Color(0, 0, 0);
$tmpColor->setEmpty(true);
$g->getPen()->color = $tmpColor;
$w = $this->chart->getAspect()->getWidth3D();
if($this->iAxis->getHorizontal())
$g->zLine($tmp, $r->getBottom(), 0, $w);
if($this->draw3D || $this->drawBehind)
$g->verticalLine($tmp, $r->y, $r->getBottom(), $w);
$g->zLine($r->x, $tmp, 0, $w);
if($this->draw3D || $this->drawBehind)
$g->horizontalLine($r->x, $r->getRight(), $tmp, $w);
if($this->chart->getAspect()->getView3D() || ((!$this->dragging) || $this->dragRepaint))
if($this->iAxis->getHorizontal())
$g->zLine($tmp, $r->y, 0, $w);
$g->verticalLine($tmp, $r->y, $r->getBottom(), 0);
$g->zLine($r->getRight(), $tmp, 0, $w);
$g->horizontalLine($r->x, $r->getRight(), $tmp, 0);
if(($this->iAxis != null) &&
((/* TODO ($e->getID() == ChartDrawEvent::$PAINTING) &&*/
(/* TODO ($e->getID() == ChartDrawEvent::$PAINTED) &&*/
$this->chart->getGraphics3D()->setPen($this->getPen());
$this->drawColorLine(/* TODO ($e->getID() == ChartDrawEvent::$PAINTING) &&*/
if($this->allowDrag && ($this->iAxis != null))
$tmpMouseEvent = new MouseEvent();
if($e->getID() == $tmpMouseEvent->MOUSE_RELEASED)
if($e->getID() == $tmpMouseEvent->MOUSE_MOVED || $e->getID() == $tmpMouseEvent->MOUSE_DRAGGED)
//MM force repaint could vary
$tmp = $this->iAxis->getHorizontal() ? $e->getX() : $e->getY();
// calculate new position
$tmpNew = $this->getAxis()->calcPosPoint($tmp);
// check inside axis limits
// do not use Axis Minimum & Maximum, we need the "real" min && max
if($this->iAxis->getHorizontal())
$tmpLimit = $this->iAxis->calcPosPoint($this->iAxis->iStartPos);
$tmpLimit = $this->iAxis->calcPosPoint($this->iAxis->iEndPos);
$tmpLimit = $this->iAxis->calcPosPoint($this->iAxis->iEndPos);
$tmpLimit = $this->iAxis->calcPosPoint($this->iAxis->iStartPos);
// call set_Value to force repaint whole chart
$tmpDoDraw = $this->lineValue != $tmpNew;
// draw line in xor mode, to avoid repaint the whole chart
$this->chart->getGraphics3D()->setPen($this->getPen());
$this->drawColorLine(true);
$this->drawColorLine(false);
$this->lineValue = $tmpNew;
$this->chart->setCancelMouse(true);
/* call event, allow event to change Value */
/* draw at new position */
$this->drawColorLine(true);
$this->drawColorLine(false);
//chart.graphics3D.getPen().Mode=pmCopy;
if($this->clicked($e->getX(), $e->getY()))
/* show appropiate cursor */
$tmpCursor = $this->iAxis->getHorizontal() ?
$c = $this->Cursor->getSystemCustomCursor($tmpCursor);
catch (Exception $exception)
$this->chart->setCancelMouse(true);
if($e->getID() == $tmpMouseEvent->MOUSE_PRESSED)
$this->dragging = $this->clicked($e->getX(), $e->getY());
$this->chart->setCancelMouse($this->dragging);
* Gets detailed descriptive text.
$this->fireDragged(new ChangeEvent($this));
$this->fireDragging(new ChangeEvent($this));
private function clicked($x, $y)
$tmp = $this->iAxis->getHorizontal() ? $x : $y;
$r = $this->chart->getChartRect();
return $this->iAxis->getHorizontal() ? ($y >= $r->y) && ($y <= $r->getBottom()) :
($this->x >= $r->x) && ($x <= $r->getRight());
* Allows mousedrag of Line when true. <br>
* Allows mousedrag of Line when true. <br>
* Repaints the Chart while moving the ColorLine when true.<br>
* Set to true to repaint the Chart while moving the ColorLine. <br>
return $this->dragRepaint;
* Set to true to repaint the Chart while moving the ColorLine. <br>
* Draws ColorLine in 3D when true.<br>
* Draws ColorLine in 3D when true.<br>
* Draws the ColorLine behind the series values.<br>
return $this->drawBehind;
* Draws the ColorLine behind the series values.<br>
* Allows drag of ColorLine outside of the Chart rectangle.<br>
return $this->noLimitDrag;
* Allows drag of ColorLine outside of the Chart rectangle.<br>
* Determines Axis position where the ColorLine has to be drawn.<br>
* Sets the Axis position where the ColorLine has to be drawn.<br>
|