steffen: server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot bar.php, NONE, 1.1 bargrouped.php, NONE, 1.1 barstacked.php, NONE, 1.1 line.php, NONE, 1.1 scatter.php, NONE, 1.1

cvs at intevation.de cvs at intevation.de
Fri Oct 14 16:33:06 CEST 2005


Author: steffen

Update of /kolabrepository/server/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot
In directory doto:/tmp/cvs-serv28903/kolab-horde-framework/kolab-horde-framework/Graph/Graph/Plot

Added Files:
	bar.php bargrouped.php barstacked.php line.php scatter.php 
Log Message:
Separated Horde Framework from kolab-resource-handlers

--- NEW FILE: bar.php ---
<?php
/**
 * Bar graph implementation for the Horde_Graph package.
 *
 * $Horde: framework/Graph/Graph/Plot/bar.php,v 1.5 2004/01/01 15:16:05 jan Exp $
 *
 * Copyright 2002-2004 Chuck Hagenbuch <chuck at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Chuck Hagenbuch <chuck at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Graph
 */
class Horde_Graph_Plot_bar {

    var $graph;

    var $_color = 'blue';
    var $_outline = 'black';
    var $_width = 10;
    var $_offset = 0;
    var $_dataset;

    function Horde_Graph_Plot_bar(&$graph, $params)
    {
        $this->graph = &$graph;

        foreach ($params as $param => $value) {
            $key = '_' . $param;
            $this->$key = $value;
        }
    }

    function draw()
    {
        $data = $this->graph->_data['y'][$this->_dataset];

        $barWidth = $this->_width;
        $barOffset = $this->_offset * $barWidth;
        $u = 0;
        $v = 0;
        $count = count($data);
        for ($i = 0; $i < $count; $i++) {
            $x = $i;
            $y = $data[$i];
            $this->graph->translate($x, $y);
            $x = $x - ($barWidth / 2) + $barOffset;
            $height = $this->graph->_graphBottom - $y;

            $this->graph->img->rectangle($x, $y, $barWidth, $height, $this->_outline, $this->_color);
        }
    }

}

--- NEW FILE: bargrouped.php ---
<?php

require_once 'Horde/Graph/Plot/bar.php';

/**
 * Grouped bar graph implementation for the Horde_Graph package.
 *
 * $Horde: framework/Graph/Graph/Plot/bargrouped.php,v 1.1 2004/05/06 21:14:56 chuck Exp $
 *
 * Copyright 2002-2004 Chuck Hagenbuch <chuck at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Chuck Hagenbuch <chuck at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Graph
 */
class Horde_Graph_Plot_bargrouped extends Horde_Graph_Plot_bar {

    var $_step = .5;
    var $_colors = array();
    var $_datasets = array();

    function draw()
    {
        // Calculate the starting offset for each bar, from which we
        // move it over by $this->_step.
        $datasets = count($this->_datasets);
        $globalOffset = $this->_offset - (($this->_step * ($datasets - 1)) / 2);

        for ($i = 0; $i < $datasets; $i++) {
            // Calculate the offset of this set of bars.
            $this->_offset = $globalOffset + ($this->_step * $i);

            // Set bar parameters that change per-group.
            if (isset($this->_colors[$i])) {
                $this->_color = $this->_colors[$i];
            }
            $this->_dataset = $this->_datasets[$i];

            // Draw this dataset.
            parent::draw();
        }
    }

}

--- NEW FILE: barstacked.php ---
<?php
/**
 * Stacked bar graph implementation for the Horde_Graph package.
 *
 * $Horde: framework/Graph/Graph/Plot/barstacked.php,v 1.1 2004/05/06 20:56:12 chuck Exp $
 *
 * Copyright 2002-2004 Chuck Hagenbuch <chuck at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Chuck Hagenbuch <chuck at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Graph
 */
class Horde_Graph_Plot_barstacked {

    var $graph;

    var $_color = 'blue';
    var $_outline = 'black';
    var $_width = 10;
    var $_offset = 0;
    var $_dataset;

    function Horde_Graph_Plot_barstacked(&$graph, $params)
    {
        $this->graph = &$graph;

        foreach ($params as $param => $value) {
            $key = '_' . $param;
            $this->$key = $value;
        }
    }

    function draw()
    {
    }

}

--- NEW FILE: line.php ---
<?php
/**
 * Line graph implementation for the Horde_Graph package.
 *
 * $Horde: framework/Graph/Graph/Plot/line.php,v 1.4 2004/01/01 15:16:05 jan Exp $
 *
 * Copyright 2002-2004 Chuck Hagenbuch <chuck at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Chuck Hagenbuch <chuck at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Graph
 */
class Horde_Graph_Plot_line {

    var $_graph;
    var $_color = 'blue';
    var $_width = 1;
    var $_dataset;

    function Horde_Graph_Plot_line(&$graph, $params)
    {
        $this->_graph = &$graph;

        foreach ($params as $param => $value) {
            $key = '_' . $param;
            $this->$key = $value;
        }
    }

    function draw()
    {
        $data = $this->_graph->_data['y'][$this->_dataset];

        $count = count($data);
        $verts = array();
        for ($i = 0; $i < $count; $i++) {
            $x = $i;
            $y = $data[$i];
            $this->_graph->translate($x, $y);
            $verts[] = array('x' => $x, 'y' => $y);
        }

        $this->_graph->img->polyline($verts, $this->_color, $this->_width);
    }

}

--- NEW FILE: scatter.php ---
<?php
/**
 * Scatter plot implementation for the Horde_Graph package.
 *
 * $Horde: framework/Graph/Graph/Plot/scatter.php,v 1.3 2004/01/01 15:16:05 jan Exp $
 *
 * Copyright 2002-2004 Chuck Hagenbuch <chuck at horde.org>
 *
 * See the enclosed file COPYING for license information (LGPL). If you
 * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
 *
 * @author  Chuck Hagenbuch <chuck at horde.org>
 * @version $Revision: 1.1 $
 * @since   Horde 3.0
 * @package Horde_Graph
 */
class Horde_Graph_Plot_scatter {

    var $_graph;
    var $_color = 'blue';
    var $_shape = 'square';
    var $_dataset;

    function Horde_Graph_Plot_scatter(&$graph, $params)
    {
        $this->_graph = &$graph;

        foreach ($params as $param => $value) {
            $key = '_' . $param;
            $this->$key = $value;
        }
    }

    function draw()
    {
        $data = $this->_graph->_data['y'][$this->_dataset];

        $count = count($data);
        $verts = array();
        for ($i = 0; $i < $count; $i++) {
            $x = $i;
            $y = $data[$i];
            $this->_graph->translate($x, $y);
            $this->_graph->img->brush($x, $y, $this->_color, $this->_shape);
        }
    }

}





More information about the commits mailing list