Beispiel #1
0
 /**
  * Output the text
  *
  * @return bool Was the output 'good' (true) or 'bad' (false).
  * @access private
  */
 function _done()
 {
     if ($this->_defaultFontOptions !== false) {
         $this->_canvas->setFont($this->_defaultFontOptions);
     } else {
         $this->_canvas->setFont($this->_getFont());
     }
     if (is_a($this->_parent, 'Image_Graph_Plotarea')) {
         $this->_setCoords($this->_parent->_left, $this->_parent->_top, $this->_parent->_right, $this->_parent->_top + $this->_canvas->textHeight($this->_text));
     } elseif (!is_a($this->_parent, 'Image_Graph_Layout')) {
         $this->_setCoords($this->_parent->_fillLeft(), $this->_parent->_fillTop(), $this->_parent->_fillRight(), $this->_parent->_fillTop() + $this->_canvas->textHeight($this->_text));
     }
     if (parent::_done() === false) {
         return false;
     }
     if ($this->_alignment == IMAGE_GRAPH_ALIGN_CENTER_X) {
         $x = ($this->_left + $this->_right) / 2;
     } elseif ($this->_alignment == IMAGE_GRAPH_ALIGN_LEFT) {
         $x = $this->_left;
     } else {
         $x = $this->_right;
     }
     $y = ($this->_top + $this->_bottom) / 2;
     $this->write($x, $y, $this->_text, $this->_alignment + IMAGE_GRAPH_ALIGN_CENTER_Y);
     return true;
 }
Beispiel #2
0
 /**
  * Output the plotarea to the canvas
  *
  * @return bool Was the output 'good' (true) or 'bad' (false).
  * @access private
  */
 function _done()
 {
     if ($this->_hasData) {
         $this->_canvas->startGroup(get_class($this));
         if ($this->_axisX != null) {
             $this->add($this->_axisX);
         }
         if ($this->_axisY != null) {
             $this->add($this->_axisY);
         }
         if ($this->_axisYSecondary != null) {
             $this->add($this->_axisYSecondary);
         }
         $this->_getFillStyle();
         $this->_canvas->rectangle(array('x0' => $this->_plotLeft, 'y0' => $this->_plotTop, 'x1' => $this->_plotRight, 'y1' => $this->_plotBottom));
         $result = parent::_done();
         $this->_canvas->endGroup();
         return $result;
     } else {
         // no data -> do nothing at all!
         return true;
     }
 }
    /**
     * Output the plotarea to the canvas
     * @access private
     */
    function _done()
    {
        if ($this->_axisX != null) {
            $this->add($this->_axisX);
        }
        if ($this->_axisY != null) {
            $this->add($this->_axisY);
        }

        if ($this->_identify) {
            $red = rand(0, 255);
            $green = rand(0, 255);
            $blue = rand(0, 255);
            $color = ImageColorAllocate($this->_canvas(), $red, $green, $blue);

            if (isset($GLOBALS['_Image_Graph_gd2'])) {
                $alphaColor = ImageColorResolveAlpha($this->_canvas(), $red, $green, $blue, 200);
            } else {
                $alphaColor = $color;
            }

            ImageRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $color);
            ImageFilledRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $alphaColor);
        }

        if ($this->_fillStyle) {
            ImageFilledRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $this->_getFillStyle());
        }

        parent::_done();

        if ($this->_plotBorderStyle) {
            ImageRectangle($this->_canvas(), $this->_plotLeft, $this->_plotTop, $this->_plotRight, $this->_plotBottom, $this->_plotBorderStyle->_getLineStyle());
        }
    }
Beispiel #4
0
 /**
  * Output the plotarea to the canvas
  *
  * @return bool Was the output 'good' (true) or 'bad' (false).
  * @access private
  */
 function _done()
 {
     $this->_getFillStyle();
     $this->_canvas->rectangle(array('x0' => $this->_fillLeft(), 'y0' => $this->_fillTop(), 'x1' => $this->_fillRight(), 'y1' => $this->_fillBottom()));
     $scaledWidth = $this->_mapSize['X'] * $this->_scale;
     $scaledHeight = $this->_mapSize['Y'] * $this->_scale;
     $this->_canvas->image(array('x' => $this->_plotLeft, 'y' => $this->_plotTop, 'filename' => $this->_imageMap, 'width' => $scaledWidth, 'height' => $scaledHeight));
     return Image_Graph_Layout::_done();
 }
    /**
     * Output the text 
     * @access private
     */
    function _done()
    {
        if (!$this->_font) {
            return false;
        }
        
        if (!is_a($this->_parent, "Image_Graph_Layout")) {
            $this->_setCoords(
                $this->_parent->_fillLeft(),
                $this->_parent->_fillTop(),
                $this->_parent->_fillRight(),
                $this->_parent->_fillTop() + $this->_font->height($this->_text)
            );
        }               
        
        parent::_done();

        $this->_font->_write(
            ($this->_left + $this->_right - $this->_font->width($this->_text)) / 2, 
            ($this->_top + $this->_bottom - $this->_font->height($this->_text)) / 2, 
            $this->_text
        );
    }