Graph::__construct PHP Method

__construct() public method

public __construct ( $w, $h, $settings = NULL )
    public function __construct($w, $h, $settings = NULL)
    {
        $this->width = $w;
        $this->height = $h;
        // get settings from ini file that are relevant to this class
        $ini_settings = @parse_ini_file('svggraph.ini', TRUE);
        if ($ini_settings === false) {
            die('svggraph.ini file not found -- exiting');
        }
        $class = get_class($this);
        $hierarchy = array($class);
        while ($class = get_parent_class($class)) {
            array_unshift($hierarchy, $class);
        }
        while (count($hierarchy)) {
            $class = array_shift($hierarchy);
            if (array_key_exists($class, $ini_settings)) {
                $this->settings = array_merge($this->settings, $ini_settings[$class]);
            }
        }
        if (is_array($settings)) {
            $this->Settings($settings);
        }
        // set default colours
        $this->colours = explode(' ', $this->svg_colours);
        shuffle($this->colours);
        unset($this->svg_colours);
    }

Usage Example

Example #1
0
 public function __construct($width = 300, $height = 200, $cachedName = "", $timeout = 0, $inline = 1)
 {
     parent::__construct($width, $height, $cachedName, $timeout, $inline);
     $this->posx = $width / 2;
     $this->posy = $height / 2;
     $this->SetColor(array(255, 255, 255));
     if ($this->graph_theme) {
         $this->graph_theme->ApplyGraph($this);
     }
 }
All Usage Examples Of Graph::__construct