BarGraph::Draw PHP Method

Draw() protected method

protected Draw ( )
    protected function Draw()
    {
        $values = $this->GetValues();
        $body = $this->Grid() . $this->Guidelines(SVGG_GUIDELINE_BELOW);
        $bar_width = $this->bar_space >= $this->bar_unit_width ? '1' : $this->bar_unit_width - $this->bar_space;
        $bar_style = array();
        $this->SetStroke($bar_style);
        $bnum = 0;
        $bspace = $this->bar_space / 2;
        $ccount = count($this->colours);
        foreach ($values as $key => $value) {
            // assign bar in the loop so it doesn't keep ID
            $bar = array('width' => $bar_width);
            $bar_pos = $this->GridPosition($key, $bnum);
            if (!is_null($bar_pos)) {
                $bar['x'] = $bspace + $bar_pos;
                $this->Bar($value, $bar);
                if ($bar['height'] > 0) {
                    $bar_style['fill'] = $this->GetColour($bnum % $ccount);
                    if ($this->show_tooltips) {
                        $this->SetTooltip($bar, $value, null, !$this->compat_events && $this->show_bar_labels);
                    }
                    $rect = $this->Element('rect', $bar, $bar_style);
                    if ($this->show_bar_labels) {
                        $rect .= $this->BarLabel($value, $bar);
                    }
                    $body .= $this->GetLink($key, $rect);
                    $this->bar_styles[] = $bar_style;
                }
            }
            ++$bnum;
        }
        $body .= $this->Guidelines(SVGG_GUIDELINE_ABOVE) . $this->Axes();
        return $body;
    }