Example #1
0
 /**
  * Render the text
  * 
  * @param ezcGraphRenderer $renderer Renderer
  * @param ezcGraphBoundings $boundings Boundings for the axis
  * @return ezcGraphBoundings Remaining boundings
  */
 public function render(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings)
 {
     $height = (int) min(round($this->properties['maxHeight'] * ($boundings->y1 - $boundings->y0)), $this->properties['font']->maxFontSize + $this->padding * 2 + $this->margin * 2);
     switch ($this->properties['position']) {
         case ezcGraph::TOP:
             $textBoundings = new ezcGraphBoundings($boundings->x0, $boundings->y0, $boundings->x1, $boundings->y0 + $height);
             $boundings->y0 += $height + $this->properties['margin'];
             break;
         case ezcGraph::BOTTOM:
             $textBoundings = new ezcGraphBoundings($boundings->x0, $boundings->y1 - $height, $boundings->x1, $boundings->y1);
             $boundings->y1 -= $height + $this->properties['margin'];
             break;
     }
     $textBoundings = $renderer->drawBox($textBoundings, $this->properties['background'], $this->properties['border'], $this->properties['borderWidth'], $this->properties['margin'], $this->properties['padding']);
     $renderer->drawText($textBoundings, $this->properties['title'], ezcGraph::CENTER | ezcGraph::MIDDLE);
     return $boundings;
 }
 /**
  * Render the background
  *
  * @param ezcGraphRenderer $renderer Renderer
  * @param ezcGraphBoundings $boundings Boundings
  * @return ezcGraphBoundings Remaining boundings
  */
 public function render(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings)
 {
     $boundings = $renderer->drawBox($boundings, $this->background, $this->border, $this->borderWidth, $this->margin, $this->padding);
     if ($this->image === false) {
         return $boundings;
     }
     $renderer->drawBackgroundImage($boundings, $this->image, $this->position, $this->repeat);
     return $boundings;
 }
 /**
  * Render a legend
  * 
  * @param ezcGraphRenderer $renderer Renderer
  * @param ezcGraphBoundings $boundings Boundings for the axis
  * @return ezcGraphBoundings Remaining boundings
  */
 public function render(ezcGraphRenderer $renderer, ezcGraphBoundings $boundings)
 {
     $boundings = $this->calculateBoundings($boundings);
     if ($this->position === ezcGraph::LEFT || $this->position === ezcGraph::RIGHT) {
         $type = ezcGraph::VERTICAL;
     } else {
         $type = ezcGraph::HORIZONTAL;
     }
     // Render standard elements
     $this->properties['boundings'] = $renderer->drawBox($this->properties['boundings'], $this->properties['background'], $this->properties['border'], $this->properties['borderWidth'], $this->properties['margin'], $this->properties['padding'], $this->properties['title'], $this->getTitleSize($this->properties['boundings'], $type));
     // Render legend
     $renderer->drawLegend($this->boundings, $this, $type);
     return $boundings;
 }