Source for file Label.class.php
Documentation is available at Label.class.php 
 * This work is hereby released into the Public Domain.  
 * To view a copy of the public domain dedication,  
 * visit http://creativecommons.org/licenses/publicdomain/ or send a letter to  
 * Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.  
require_once dirname(__FILE__ ). "/../Graph.class.php";  
 * @package linea21.externals  
     * Move position from this vector  
     * @param string $label First label  
     function awLabel($label =  NULL, $font =  NULL, $color =  NULL, $angle =  0) {  
            $this->set(array($label));  
        if(is_a($color, 'awColor')) {  
     * Get an element of the label from its key  
     * @param int $key Element key  
     * Set one or several labels  
     * @param array $labels Array of string or a string  
            $this->texts =  array((string) $labels);  
     * Count number of texts in the label  
     * Set a callback function for labels  
     * @param string $function   
     * Return the callback function for labels  
     * @param string $format New format (printf style: %.2f for example)  
        eval ('function '. $function. '($value) { 
            return sprintf("'. addcslashes($format, '"'). '", $value);  
     * @param $color Font color (can be NULL)  
     function setFont(&$font, $color =  NULL) {  
        if(is_a($color, 'awColor')) {  
     * @param int $angle New angle  
        $this->angle = (int) $angle;  
     * @param mixed $background   
     * Change text background color  
     * Change text background gradient  
     * @param int $left Left padding  
     * @param int $right Right padding  
     * @param int $top Top padding  
     * @param int $bottom Bottom padding  
     function setPadding($left, $right, $top, $bottom) {  
        $this->padding =  array((int) $left, (int) $right, (int) $top, (int) $bottom);  
     function hide($hide =  TRUE) {  
        $this->hide = (bool) $hide;  
     function show($show =  TRUE) {  
        $this->hide = (bool) !$show;  
     * @param int $key The key to hide  
     * @param int $value The value to hide  
     * @param int $x Add this interval to X coord  
     * @param int $y Add this interval to Y coord  
        $this->move =  $this->move->move($x, $y);  
     * @param int $h Horizontal alignment  
     * @param int $v Vertical alignment  
     function setAlign($h =  NULL, $v =  NULL) {  
     * Get a text from the labele  
     * @param mixed $key Key in the array text  
            $value =  $this->texts[$key];  
            $text->setFont($this->font);  
            $text->setAngle($this->angle);  
            $text->setColor($this->color);  
            $text->border =  $this->border;  
     * Get max width of all texts  
     * @param $driver A driver  
        return $this->getMax($driver, 'getTextWidth');  
     * Get max height of all texts  
     * @param $driver A driver  
        return $this->getMax($driver, 'getTextHeight');  
     * @param int $key Text position in the array of texts (default to zero)  
     function draw($driver, $p, $key =  0) {  
            list ($left, $right, $top, $bottom) =  $text->getPadding(); 
//            $font = $text->getFont();  
            $width =  $driver->getTextWidth($text);  
            $height =  $driver->getTextHeight($text);  
                    $x -=  ($width -  $left +  $right) /  2;  
                    $y -=  ($height +  $bottom);  
                    $y -=  ($height -  $top +  $bottom) /  2;  
            $driver->string($text, $this->move->move($x, $y));  
     function getMax($driver, $function) {  
        foreach($this->texts as $key =>  $text) {  
            $font =  $text->getFont();  
                $max =  $font->{$function}($text);  
                $max =  max($max, $font->{$function}($text));  
 
 
        
       |