Source for file SeriesPointer.php
Documentation is available at SeriesPointer.php
* <p>Title: SeriesPointer class</p>
* <p>Description: Some Series have a Pointer method which returns a
* SeriesPointer class. Pointers are shape figures drawn on each Y point
* <p>Copyright (c) 2005-2008 by Steema Software SL. All Rights
* <p>Company: Steema Software SL</p>
private $xMinus, $xPlus, $yMinus, $yPlus;
function __get( $property ) {
$method = "get{$property}";
function __set ( $property,$value ) {
$method = "set{$property}";
return $this->$method($value);
public function assign($source) {
if ($source->bBrush != null) {
$this->getBrush()->assign($source->bBrush);
if ($source->pen != null) {
$this->getPen()->assign($source->pen);
$this->style = $source->style;
$this->vertSize = $source->vertSize;
$this->horizSize = $source->horizSize;
$this->dark3D = $source->dark3D;
$this->draw3D = $source->draw3D;
$this->inflate = $source->inflate;
* Fills pointer sides in 3D mode with darker color.<br>
* Fills pointer sides in 3D mode with darker color.<br>
* Draws pointer in 3D mode.<br>
* Currently only rectangle points have 3D capability. <br>
* Draws pointer in 3D mode.<br>
* Shows or hides the pointer.<br>
* When using a Points series (or any Series class derived from Points
* series), setting Visible to false will not display anything. <br>
* Pointers can be useful with Line series or Area series. <br>
* When points are Visible, extra margins are applied to the four chart
* axes (Left, Right, Top and Bottom). This is to make points just at axis
* limits to be shown. <br>
* You can deactivate these extra margins by setting
* IPointer.InflateMargins to false. <br><br>
* Points are filled using IPointer.Brush.
* Shows or hides the pointer.<br>
* Horizontal size of pointer in pixels.<br>
* Series that derive from Points series usually override the HorizSize
* and VertSize methods. <br>
* For example, Bubble series uses the Radius method to determine the
* correct HorizSize and VertSize, so these methods have no effect in
* Horizontal size of pointer in pixels.<br>
* Expands axes to fit pointers.<br>
* When false, Chart Axis scales will be preserved and points close to the
* Axis limits will be partially displayed. <br>
* Expands axes to fit pointers.<br>
* It defines the shape used to display the Series Points.<br>
* The default Rectangle style can be optionally in 3D mode by setting
* Pointer.Draw3D to true. <br>
* Series Pointer.Visible should be true.<br>
* Default value: rectangle
* Sets the Pointer style.<br>
* Default value: rectangle
* @param value PointerStyle
if ($this->style != $value) {
* The Horizontal size of pointer in pixels.<br>
* Series that derive from PointSeries usually override the HorizontalSize
* and VerticalSize methods. <br>
* For example, Bubble series uses the Radius property to determine the
* correct HorizSize and VertSize, so these methods have no effect in
* Sets Horizontal size of pointer in pixels.<br>
* The Percent of semiglass effect.<br>
return $this->getBrush()->getTransparency();
* Sets Percent of semiglass effect.<br>
* <pre><font face="Courier" size="4">
* bubbleSeries.getPointer().setTransparency(50); // -- 50 %
$this->getBrush()->setTransparency($value);
* Configures Gradient filling attributes.<br>
* <pre><font face="Courier" size="4">
* bubbleSeries.getPointer().getGradient().setVisible(true);
return $this->getBrush()->getGradient();
private function drawDiagonalCross($g, $is3D, $colorValue) {
//g.AssignVisiblePenColor(Pen,ColorValue);
$g->line($this->xMinus, $this->yMinus, $this->xPlus + 1, $this->yPlus + 1, $this->getStartZ());
$g->line($this->xPlus, $this->yMinus, $this->xMinus - 1, $this->yPlus + 1, $this->getStartZ());
$g->line($this->xMinus, $this->yMinus, $this->xPlus + 1, $this->yPlus + 1);
$g->line($this->xPlus, $this->yMinus, $this->xMinus - 1, $this->yPlus + 1);
private function drawCross($g, $is3D, $px, $py, $colorValue) {
//g.AssignVisiblePenColor(Pen,ColorValue);
$g->verticalLine($px, $this->yMinus, $this->yPlus + 1, $this->getStartZ());
$g->horizontalLine($this->xMinus, $this->xPlus + 1, $py, $this->getStartZ());
$g->verticalLine($px, $this->yMinus, $this->yPlus + 1);
$g->horizontalLine($this->xMinus, $this->xPlus + 1, $py);
private function doTriangle3D($g, $deltaY, $px, $py) {
$g->pyramid(true, $this->xMinus, $py - $deltaY, $this->xPlus, $py + $deltaY,
$g->triangle(new TeePoint($this->xMinus, $py + $deltaY),
new TeePoint($this->xPlus, $py + $deltaY),
private function doHorizTriangle3D($g, $deltaX, $px, $py) {
$g->pyramid(false, $px + $deltaX, $this->yMinus, $px - $deltaX, $this->yPlus,
$g->triangle(new TeePoint($px + $deltaX, $this->yMinus),
new TeePoint($px + $deltaX, $this->yPlus),
if ($this->series != null) {
return $this->series->getStartZ();
if ($this->series != null) {
return $this->series->getMiddleZ();
if ($this->series != null) {
return $this->series->getEndZ();
* Sets the pointer color.
if ($this->pen != null) {
$this->pen->setChart($c);
if ($this->bBrush != null) {
$this->bBrush->setChart($c);
* Internal use. Draw Pointer
* @param colorValue Color
* @param aStyle PointerStyle
public function intDraw($g, $is3D, $px, $py, $tmpHoriz,$tmpVert,
$colorValue, $aStyle= 0) {
$old_name = TChart::$controlName;
TChart::$controlName .= 'SeriesPointer_';
// tODO $g->getBrush()->setTransparency($this->getBrush()->getTransparency());
// TODO $g->getBrush()->setColor($colorValue->transparentColor($g->getBrush()->
// $this->getTransparency()));
$this->xMinus = $px - $tmpHoriz;
$this->xPlus = $px + $tmpHoriz;
$this->yMinus = $py - $tmpVert;
$this->yPlus = $py + $tmpVert;
if ($aStyle == PointerStyle::$RECTANGLE) {
$g->cube($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus, $this->getStartZ(),
$g->rectangleWithZ(new Rectangle($this->xMinus, $this->yMinus, $this->xPlus + 1, $this->yPlus + 1),
if ($this->draw3D && $g->getSupportsFullRotation()) {
$g->sphere($px, $py, $this->getMiddleZ(), $tmpHoriz);
$g->ellipse($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus, $this->getStartZ());
$g->sphere(Rectangle::fromLTRB($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus),
$g->ellipse($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus, $this->getStartZ(), true);
$this->doTriangle3D($g, $tmpVert, $px, $py);
$this->doTriangle3D($g, - $tmpVert, $px, $py);
$this->doHorizTriangle3D($g, $tmpHoriz, $px, $py);
$this->doHorizTriangle3D($g, - $tmpHoriz, $px, $py);
$this->drawCross($g, true, $px, $py, $colorValue);
$this->drawDiagonalCross($g, true, $colorValue);
$this->drawCross($g, true, $px, $py, $colorValue);
$this->drawDiagonalCross($g, true, $colorValue);
$g->plane(new TeePoint($this->xMinus, $py),
$g->setPixel($px, $py, $this->getMiddleZ(), $colorValue);
$g->rectangle(new Rectangle($this->xMinus, $this->yMinus, ($tmpHoriz* 2) + 1, ($tmpVert* 2) + 1));
$g->ellipse($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus);
// $g->ellipse($px, $py, $tmpHoriz, $tmpVert);
$g->sphere($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus, true);
$g->ellipse($this->xMinus, $this->yMinus, $this->xPlus, $this->yPlus, true);
$p = Array(new TeePoint($this->xMinus, $this->yPlus),
new TeePoint($this->xPlus, $this->yPlus),
$p = Array(new TeePoint($this->xMinus, $this->yMinus),
new TeePoint($this->xPlus, $this->yMinus),
$p = Array(new TeePoint($this->xMinus, $py),
new TeePoint($this->xPlus, $this->yMinus),
new TeePoint($this->xPlus, $this->yPlus));
$p = Array(new TeePoint($this->xMinus, $this->yMinus),
new TeePoint($this->xMinus, $this->yPlus),
$this->drawCross($g, false, $px, $py, $colorValue);
$this->drawDiagonalCross($g, false, $colorValue);
$this->drawCross($g, false, $px, $py, $colorValue);
$this->drawDiagonalCross($g, false, $colorValue);
$p = Array(new TeePoint($this->xMinus, $py),
$g->setPixel($px, $py, $this->getMiddleZ(), $colorValue);
TChart::$controlName= $old_name;
public function draw($px, $py, $colorValue, $aStyle= 0) {
$this->intDraw($this->chart->getGraphics3D(), $this->chart->getAspect()->getView3D(), $px, $py,
public /* todo review protected*/ function prepareCanvas($g, $colorValue) {
$tmpColor = new Color(0,0,0); // Todo TransparentColor
if ($this->pen->getColor()->isEmpty() || $colorValue == $tmpColor) {
$g->getPen()->setColor($colorValue);
if ($this->bBrush->getColor()->isEmpty()) {
$g->getBrush()->setForegroundColor($this->bBrush->getSolid() ? $colorValue :
$g->getBrush()->setColor($colorValue);
} else if ($this->series != null) {
$g->getBrush()->setColor($colorValue);
$g->getBrush()->setColor($this->bBrush->getColor());
$g->getBrush()->setColor($colorValue);
* Pen used to draw a frame around Series Pointers.
if ($this->pen == null) {
$tmpColor = new Color(0,0,0);
* Brush used to fill Series Pointers.
if ($this->bBrush == null) {
if ($this->series != null) {
$this->bBrush->setColor($this->series->getColor());
protected function drawLegendShape($color, $rect, $drawPen) {
$this->drawLegendShape($this->chart->getGraphics3D(), $color, $rect, $drawPen);
/* todo check why protected*/ public function drawLegendShape($g, $color, $rect, $drawPen) {
$tmpHoriz = $rect->width / 3;
$tmpVert = $rect->height / 3;
$tmpHoriz = 1 + ($rect->width / 2);
$tmpVert = 1 + ($rect->height / 2);
$this->intDraw($g, false, ($rect->x + $rect->getRight()) / 2,
($rect->y + $rect->getBottom()) / 2,
min($this->horizSize, $tmpHoriz),
min($this->vertSize, $tmpVert), $color, $this->style);
if ($this->bVisible && $this->inflate) {
$margins->min = max($margins->min, $this->horizSize + 1);
$margins->max = max($margins->max, $this->horizSize + 1);
if ($this->bVisible && $this->inflate) {
$margins->min = max($margins->min, $this->vertSize + 1);
$margins->max = max($margins->max, $this->vertSize + 1);
|