当前位置: 首页>>代码示例>>PHP>>正文


PHP Image_Graph::factory方法代码示例

本文整理汇总了PHP中Image_Graph::factory方法的典型用法代码示例。如果您正苦于以下问题:PHP Image_Graph::factory方法的具体用法?PHP Image_Graph::factory怎么用?PHP Image_Graph::factory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Image_Graph的用法示例。


在下文中一共展示了Image_Graph::factory方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Image_Graph_Plotarea_Radar

 /**
  * Create the plotarea, implicitely creates 2 normal axis
  */
 function Image_Graph_Plotarea_Radar()
 {
     parent::Image_Graph_Element();
     $this->_padding = 10;
     $this->_axisX =& Image_Graph::factory('Image_Graph_Axis_Radar');
     $this->_axisX->_setParent($this);
     $this->_axisY =& Image_Graph::factory('Image_Graph_Axis', IMAGE_GRAPH_AXIS_Y);
     $this->_axisY->_setParent($this);
     $this->_axisY->_setMinimum(0);
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:13,代码来源:Radar.php

示例2: __construct

 /**
  * Create the plotarea, implicitely creates 2 normal axis
  */
 function __construct()
 {
     parent::__construct();
     $this->_padding = array('left' => 10, 'top' => 10, 'right' => 10, 'bottom' => 10);
     $this->_axisX =& Image_Graph::factory('Image_Graph_Axis_Radar');
     $this->_axisX->_setParent($this);
     $this->_axisY =& Image_Graph::factory('Image_Graph_Axis', IMAGE_GRAPH_AXIS_Y);
     $this->_axisY->_setParent($this);
     $this->_axisY->_setMinimum(0);
 }
开发者ID:Spark-Eleven,项目名称:revive-adserver,代码行数:13,代码来源:Radar.php

示例3: showImageData

 /** Return the actual Image data
  * Classes must override this.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function showImageData()
 {
     require_once "Image/Graph.php";
     $db = AbstractDb::getObject();
     $Graph =& Image_Graph::factory("Image_Graph", array(600, 200));
     $Plotarea =& $Graph->add(Image_Graph::factory("Image_Graph_Plotarea"));
     $Dataset =& Image_Graph::factory("Image_Graph_Dataset_Trivial");
     $Bar =& Image_Graph::factory("Image_Graph_Plot_Bar", $Dataset);
     $Bar->setFillColor("#9db8d2");
     $Plot =& $Plotarea->add($Bar);
     $candidate_connections_sql = self::$stats->getSqlCandidateConnectionsQuery("COUNT(distinct user_mac) AS connections, extract('hour' from timestamp_in) AS hour");
     $db->execSql("{$candidate_connections_sql} GROUP BY hour ORDER BY hour", $results, false);
     if ($results) {
         foreach ($results as $row) {
             $Dataset->addPoint($row['hour'] . "h", $row['connections']);
         }
     }
     $Graph->done();
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:24,代码来源:ConnectionsPerHour.php

示例4: showImageData

 /** Return the actual Image data
  * Classes must override this.
  * @param $child_html The child method's return value
  * @return A html fragment
  */
 public function showImageData()
 {
     require_once "Image/Graph.php";
     $db = AbstractDb::getObject();
     $Graph =& Image_Graph::factory("Image_Graph", array(600, 200));
     $Plotarea =& $Graph->add(Image_Graph::factory("Image_Graph_Plotarea"));
     $Dataset =& Image_Graph::factory("Image_Graph_Dataset_Trivial");
     $Bar =& Image_Graph::factory("Image_Graph_Plot_Bar", $Dataset);
     $Bar->setFillColor("#9db8d2");
     $Plot =& $Plotarea->add($Bar);
     $total = 0;
     $network_constraint = self::$stats->getSqlNetworkConstraint('account_origin');
     $date_constraint = self::$stats->getSqlDateConstraint('reg_date');
     $db->execSql("SELECT COUNT(users) AS num_users, date_trunc('month', reg_date) AS month FROM users  WHERE account_status = " . ACCOUNT_STATUS_ALLOWED . " {$date_constraint} {$network_constraint} GROUP BY date_trunc('month', reg_date) ORDER BY month", $registration_stats, false);
     if ($registration_stats) {
         foreach ($registration_stats as $row) {
             $Dataset->addPoint(substr($row['month'], 0, 7), $row['num_users']);
         }
     }
     $Graph->done();
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:26,代码来源:RegistrationsPerMonth.php

示例5: create_graph_usemap01

function create_graph_usemap01($width = 700, $height = 160, $fontsize = 7)
{
    $Canvas =& Image_Canvas::factory('png', array('width' => $width, 'height' => $height, 'usemap' => true));
    // This is how you get the ImageMap object,
    // fx. to save map to file (using toHtml())
    $Imagemap = $Canvas->getImageMap();
    // Create the graph
    //$Graph =& Image_Graph::factory('graph', array(600, 140));
    $Graph =& Image_Graph::factory('graph', $Canvas);
    // add a TrueType font
    //$myfont = '/usr/share/fonts/truetype/freefont/FreeSans.ttf';
    $myfont = '/usr/share/fonts/truetype/freefont/FreeSerif.ttf';
    $Font =& $Graph->addNew('font', $myfont);
    //$Font =& $Graph->addNew('font', 'Verdana');
    //$Font =& $Graph->addNew('font', 'Helvetica');
    // set the font size
    $Font->setSize($fontsize);
    $Graph->setFont($Font);
    #return array(&$Graph, &$Font);
    return $Graph;
}
开发者ID:thuvh,项目名称:IPTV-Analyzer,代码行数:21,代码来源:graphs.inc.php

示例6: Image_Graph

 /**
  * Image_Graph [Constructor].
  *
  * If passing the 3 parameters they are defined as follows:'
  * 
  * Fx.:
  * 
  * $Graph =& new Image_Graph(400, 300);
  * 
  * or using the factory method:
  * 
  * $Graph =& Image_Graph::factory('graph', array(400, 300));
  * 
  * This causes a 'png' canvas to be created by default. 
  * 
  * Otherwise use a single parameter either as an associated array or passing
  * the canvas along to the constructor:
  *
  * 1) Create a new canvas with the following parameters:
  *
  * 'canvas' - The canvas type, can be any of 'gd', 'jpg', 'png' or 'svg'
  * (more to come) - if omitted the default is 'gd'
  *
  * 'width' - The width of the graph
  *
  * 'height' - The height of the graph
  * 
  * An example of this usage:
  * 
  * $Graph =& Image_Graph::factory('graph', array(array('width' => 400,
  * 'height' => 300, 'canvas' => 'jpg')));
  * 
  * NB! In thïs case remember the "double" array (see {@link Image_Graph::
  * factory()})
  * 
  * 2) Use the canvas specified, pass a valid Image_Canvas as
  * parameter. Remember to pass by reference, i. e. &$canvas, fx.:
  *
  * $Graph =& new Image_Graph($Canvas);
  *
  * or using the factory method:
  *
  * $Graph =& Image_Graph::factory('graph', $Canvas));
  *
  * @param mixed $params The width of the graph, an indexed array
  * describing a new canvas or a valid {@link Image_Canvas} object
  * @param int $height The height of the graph in pixels
  * @param bool $createTransparent Specifies whether the graph should be
  *   created with a transparent background (fx for PNG's - note: transparent
  *   PNG's is not supported by Internet Explorer!)
  */
 function Image_Graph($params, $height = false, $createTransparent = false)
 {
     parent::__construct();
     $this->setFont(Image_Graph::factory('Image_Graph_Font'));
     if (defined('IMAGE_GRAPH_DEFAULT_CANVAS_TYPE')) {
         $canvasType = IMAGE_GRAPH_DEFAULT_CANVAS_TYPE;
     } else {
         $canvasType = 'png';
         // use GD as default, if nothing else is specified
     }
     if (is_array($params)) {
         if (isset($params['canvas'])) {
             $canvasType = $params['canvas'];
         }
         $width = 0;
         $height = 0;
         if (isset($params['width'])) {
             $width = $params['width'];
         }
         if (isset($params['height'])) {
             $height = $params['height'];
         }
     } elseif (is_a($params, 'Image_Canvas')) {
         $this->_canvas =& $params;
         $width = $this->_canvas->getWidth();
         $height = $this->_canvas->getHeight();
     } elseif (is_numeric($params)) {
         $width = $params;
     }
     if ($this->_canvas == null) {
         include_once 'Image/Canvas.php';
         $this->_canvas =& Image_Canvas::factory($canvasType, array('width' => $width, 'height' => $height));
     }
     $this->_setCoords(0, 0, $width - 1, $height - 1);
 }
开发者ID:Apeplazas,项目名称:plazadelatecnologia,代码行数:86,代码来源:Graph.php

示例7: array

<?php

/**
 * Usage example for Image_Graph.
 * 
 * Main purpose: 
 * Somebody liked it :)
 * 
 * Other: 
 * None specific
 * 
 * $Id: misc04.php,v 1.2 2005/08/03 21:21:53 nosey Exp $
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(500, 300));
$Plotarea =& $Graph->addNew('plotarea');
$Dataset =& Image_Graph::factory('Image_Graph_Dataset_Random', array(20, 10, 100, true));
$Fill =& Image_Graph::factory('Image_Graph_Fill_Image', './images/audi-tt-coupe.jpg');
$Plotarea->setFillStyle($Fill);
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Smoothed_Area', $Dataset);
$Plot->setFillColor('white@0.4');
// output the Graph
$Graph->done();
开发者ID:hbustun,项目名称:agilebill,代码行数:27,代码来源:misc04.php

示例8: elseif

 /**
  * Adds an element to the plotarea
  *
  * @param Image_Graph_Element $element The element to add
  * @param int $axis The axis to associate the element with, either
  * IMAGE_GRAPH_AXIS_X, IMAGE_GRAPH_AXIS_Y, IMAGE_GRAPH_AXIS_Y_SECONDARY
  * or the shorter string notations 'x', 'y' or 'ysec' (defaults to
  * IMAGE_GRAPH_AXIS_Y)
  * @return Image_Graph_Element The added element
  * @see Image_Graph_Common::add()
  */
 function &add(&$element, $axis = IMAGE_GRAPH_AXIS_Y)
 {
     if ($axis == 'x') {
         $axis = IMAGE_GRAPH_AXIS_X;
     }
     if ($axis == 'y') {
         $axis = IMAGE_GRAPH_AXIS_Y;
     }
     if ($axis == 'ysec') {
         $axis = IMAGE_GRAPH_AXIS_Y_SECONDARY;
     }
     if ($axis == IMAGE_GRAPH_AXIS_Y_SECONDARY && $this->_axisYSecondary == null) {
         $this->_axisYSecondary =& Image_Graph::factory('axis', IMAGE_GRAPH_AXIS_Y_SECONDARY);
         $this->_axisYSecondary->_setMinimum(0);
         if ($this->_horizontal) {
             $this->_axisYSecondary->_transpose = true;
         }
     }
     parent::add($element);
     if (is_a($element, 'Image_Graph_Plot')) {
         $element->_setAxisY($axis);
         // postpone extrema calculation until we calculate coordinates
         //$this->_setExtrema($element);
     } elseif (is_a($element, 'Image_Graph_Grid')) {
         switch ($axis) {
             case IMAGE_GRAPH_AXIS_X:
                 if ($this->_axisX != null) {
                     $element->_setPrimaryAxis($this->_axisX);
                     if ($this->_axisY != null) {
                         $element->_setSecondaryAxis($this->_axisY);
                     }
                 }
                 break;
             case IMAGE_GRAPH_AXIS_Y:
                 if ($this->_axisY != null) {
                     $element->_setPrimaryAxis($this->_axisY);
                     if ($this->_axisX != null) {
                         $element->_setSecondaryAxis($this->_axisX);
                     }
                 }
                 break;
             case IMAGE_GRAPH_AXIS_Y_SECONDARY:
                 if ($this->_axisYSecondary != null) {
                     $element->_setPrimaryAxis($this->_axisYSecondary);
                     if ($this->_axisX != null) {
                         $element->_setSecondaryAxis($this->_axisX);
                     }
                 }
                 break;
         }
     } elseif (is_a($element, 'Image_Graph_Axis')) {
         switch ($element->_type) {
             case IMAGE_GRAPH_AXIS_X:
                 $this->_axisX =& $element;
                 break;
             case IMAGE_GRAPH_AXIS_Y:
                 $this->_axisY =& $element;
                 break;
             case IMAGE_GRAPH_AXIS_Y_SECONDARY:
                 $this->_axisYSecondary =& $element;
                 break;
         }
         if ($element->_getMinimum() == $element->_getMaximum()) {
             $element->_setMinimum(0);
             $element->_setMaximum(1);
         }
     }
     return $element;
 }
开发者ID:hbustun,项目名称:agilebill,代码行数:80,代码来源:Plotarea.php

示例9: array

// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Stacked Bar Chart Sample', 12)), Image_Graph::vertical($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 90), 5));
$Legend->setPlotarea($Plotarea);
// create the dataset
$Datasets[] =& Image_Graph::factory('random', array(10, 0, 4, false));
$Datasets[] =& Image_Graph::factory('random', array(10, 0, 4, false));
$Datasets[] =& Image_Graph::factory('random', array(10, 0, 4, false));
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('bar', array($Datasets, 'stacked'));
// set a line color
$Plot->setLineColor('gray');
// create a fill array
$FillArray =& Image_Graph::factory('Image_Graph_Fill_Array');
$FillArray->addColor('blue@0.2');
$FillArray->addColor('yellow@0.2');
$FillArray->addColor('green@0.2');
// set a standard fill style
$Plot->setFillStyle($FillArray);
// create a Y data value marker
$Marker =& $Plot->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y);
// and use the marker on the 1st plot
$Plot->setMarker($Marker);
$Plot->setDataSelector(Image_Graph::factory('Image_Graph_DataSelector_NoZeros'));
// output the Graph
$Graph->done();
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:plot_bar_stacked.php

示例10: showImageData

 /** Return the actual Image data
  * Classes must override this.
  * @param $child_html The child method's return value
  * @param $param mixed: used for $Graph->done()
  * @return A html fragment
  */
 public function showImageData($child_html = '', $param = false)
 {
     require_once "Image/Graph.php";
     $db = AbstractDb::getObject();
     $Graph =& Image_Graph::factory("Image_Graph", array(600, 200));
     $Plotarea =& $Graph->add(Image_Graph::factory("Image_Graph_Plotarea"));
     $Dataset =& Image_Graph::factory("Image_Graph_Dataset_Trivial");
     $Bar =& Image_Graph::factory("Image_Graph_Plot_Bar", $Dataset);
     $Bar->setFillColor("#9db8d2");
     $Plot =& $Plotarea->add($Bar);
     $candidate_connections_sql = self::$stats->getSqlCandidateConnectionsQuery("COUNT(DISTINCT connections.user_id||connections.node_id) AS daily_connections, date_trunc('day', timestamp_in) AS date");
     $db->execSql("SELECT SUM(daily_connections) AS connections, date_trunc('month', date) AS month FROM ({$candidate_connections_sql} GROUP BY date) AS daily_connections_table GROUP BY month ORDER BY month", $results, false);
     if ($results != null) {
         foreach ($results as $row) {
             /* Cut xxxx-xx-xx xx:xx:Xx to yy-mm */
             $Dataset->addPoint(substr($row['month'], 0, 7), $row['connections']);
         }
     }
     $Graph->done($param);
     unset($Graph, $Plot, $Bar, $Plotarea, $Dataset, $row, $results);
 }
开发者ID:soitun,项目名称:wifidog-auth,代码行数:27,代码来源:VisitsPerMonth.php

示例11: get_weekly_volume_graph

function get_weekly_volume_graph($userID, $connection)
{
    $beg_date = new Date();
    $end_date = new Date();
    $wk = array(0, 0, 0, 0, 0, 0, 0);
    $wk_actual = array(0, 0, 0, 0, 0, 0, 0);
    $label = array(0, 0, 0, 0, 0, 0, 0);
    $filename = array("filename" => "/var/www/vanhlebarsoftware/fitlog/graphs/wklygraph.jpg");
    // Get current weeks and prior three weeks volume numbers and the next three weeks.
    $day_of_wk = $beg_date->getDayOfWeek();
    $beg_date->addDays(-($day_of_wk - 1) + 21);
    $end_date->copy($beg_date);
    $end_date->addDays(6);
    for ($i = 0; $i < 7; $i++) {
        // Get the planned volume for this particular week.
        $query = "SELECT SUM(seconds) AS seconds FROM flmain WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='p'";
        $queryStr = "SELECT SUM(seconds) AS seconds FROM flstrength WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='p'";
        $result = @mysql_query($query, $connection);
        $resultStr = @mysql_query($query, $connection);
        if ($result || $resultStr) {
            $tmp = 0;
            if ($result) {
                $row = mysql_fetch_array($result);
                $tmp = convert_seconds_minutes($row["seconds"]);
            }
            if ($resultStr) {
                $rowStr = mysql_fetch_array($resultStr);
                $tmp += convert_seconds_minutes($rowStr["seconds"]);
            }
            $wk[$i] = $tmp;
        } else {
            $wk[$i] = 0;
        }
        // Get the actual volume for this particular week.
        $query = "SELECT SUM(seconds) AS seconds FROM flmain WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='a'";
        $queryStr = "SELECT SUM(seconds) AS seconds FROM flstrength WHERE workout_date>='" . $beg_date->format("%Y-%m-%d") . "' AND workout_date<='" . $end_date->format("%Y-%m-%d") . "' AND user_id=" . $userID . " AND plan_type='a'";
        $result = @mysql_query($query, $connection);
        $resultStr = @mysql_query($queryStr, $connection);
        if ($result || $resultStr) {
            $tmp = 0;
            if ($result) {
                $row = mysql_fetch_array($result);
                $tmp = convert_seconds_minutes($row["seconds"]);
            }
            if ($resultStr) {
                $rowStr = mysql_fetch_array($resultStr);
                $tmp += convert_seconds_minutes($rowStr["seconds"]);
            }
            $wk_actual[$i] = $tmp;
        } else {
            $wk_actual[$i] = 0;
        }
        // Create the labels.
        $label[$i] = $end_date->format("%m/%d");
        // Move the dates back by one week.
        $beg_date->addDays(-7);
        $end_date->addDays(-7);
    }
    for ($i = 0; $i < 7; $i++) {
    }
    //Setup the graph.
    $Graph =& Image_Graph::factory('graph', array(300, 210, TRUE));
    $Graph->add(Image_Graph::factory('title', array('Weekly Volume - Actual vs. Planned'), 12));
    $Plotarea =& $Graph->addNew('plotarea');
    $Dataset =& Image_Graph::factory('dataset');
    $Dataset1 =& Image_Graph::factory('dataset');
    // Add the actual volume to the graph.
    $Dataset1->addPoint($label[6], $wk_actual[6]);
    $Dataset1->addPoint($label[5], $wk_actual[5]);
    $Dataset1->addPoint($label[4], $wk_actual[4]);
    $Dataset1->addPoint($label[3], $wk_actual[3]);
    $Dataset1->addPoint($label[2], $wk_actual[2]);
    $Dataset1->addPoint($label[1], $wk_actual[1]);
    $Dataset1->addPoint($label[0], $wk_actual[0]);
    // Add the planned volume to the graph.
    $Dataset->addPoint($label[6], $wk[6]);
    $Dataset->addPoint($label[5], $wk[5]);
    $Dataset->addPoint($label[4], $wk[4]);
    $Dataset->addPoint($label[3], $wk[3]);
    $Dataset->addPoint($label[2], $wk[2]);
    $Dataset->addPoint($label[1], $wk[1]);
    $Dataset->addPoint($label[0], $wk[0]);
    // Plot the actual data to the graph.
    $Plot =& $Plotarea->addNew('line', &$Dataset);
    $Plot1 =& $Plotarea->addNew('bar', &$Dataset1);
    $Plot1->setFillColor('green@.8');
    // Set the axis titles.
    $YAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
    $YAxis->setTitle('Minutes', 'vertical');
    $XAxis =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
    $XAxis->setTitle("Week", array('angle' => 0));
    //Output the finished graph to the graphs directory.
    $result = $Graph->done($filename);
    if ($result) {
        var_dump("error creating graph!");
    }
}
开发者ID:EABonney,项目名称:Fitlog,代码行数:97,代码来源:dashboard.php

示例12: array

$Dataset_Rainfall->addPoint('Mar', 48);
$Dataset_Rainfall->addPoint('Apr', 42);
$Dataset_Rainfall->addPoint('May', 50);
$Dataset_Rainfall->addPoint('Jun', 55);
$Dataset_Rainfall->addPoint('Jul', 67);
$Dataset_Rainfall->addPoint('Aug', 65);
$Dataset_Rainfall->addPoint('Sep', 72);
$Dataset_Rainfall->addPoint('Oct', 77);
$Dataset_Rainfall->addPoint('Nov', 80);
$Dataset_Rainfall->addPoint('Dec', 68);
$Plot_Rainfall =& $Plotarea_Weather->addNew('bar', array(&$Dataset_Rainfall), IMAGE_GRAPH_AXIS_Y_SECONDARY);
$Plot_Rainfall->setLineColor('gray');
$Plot_Rainfall->setFillColor('blue@0.1');
$Plot_Rainfall->setTitle('Average rainfall');
$DataPreprocessor_MM =& Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d mm');
$DataPreprocessor_DegC =& Image_Graph::factory('Image_Graph_DataPreprocessor_Formatted', '%d C');
$Marker_Rainfall =& $Plot_Rainfall->addNew('Image_Graph_Marker_Value', IMAGE_GRAPH_VALUE_Y);
$Marker_Rainfall->setDataPreprocessor($DataPreprocessor_MM);
$PointingMarker_Rainfall =& $Plot_Rainfall->addNew('Image_Graph_Marker_Pointing_Angular', array(20, &$Marker_Rainfall));
$Plot_Rainfall->setMarker($PointingMarker_Rainfall);
$AxisX_Weather =& $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisX_Weather->setAxisIntersection('min');
$AxisY_Weather =& $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y);
$AxisY_Weather->showLabel(IMAGE_GRAPH_LABEL_ZERO);
$AxisY_Weather->setDataPreprocessor($DataPreprocessor_DegC);
$AxisY_Weather->setTitle('Temperature', 'vertical');
$AxisYsecondary_Weather =& $Plotarea_Weather->getAxis(IMAGE_GRAPH_AXIS_Y_SECONDARY);
$AxisYsecondary_Weather->setDataPreprocessor($DataPreprocessor_MM);
$AxisYsecondary_Weather->setTitle('Rainfall', 'vertical2');
// output the graph
$Graph->done();
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:misc05.php

示例13: pipeline_by_lead_source

 /**
  * Creates pie chart image of opportunities by lead_source.
  * param $datax- the sales stage data to display in the x-axis
  * param $datay- the sum of opportunity amounts for each opportunity in each sales stage
  * to display in the y-axis
  * Portions created by SugarCRM are Copyright (C) SugarCRM, Inc..
  * All Rights Reserved..
  * Contributor(s): ______________________________________..
  */
 function pipeline_by_lead_source($legends = array('foo', 'bar'), $user_id = array('1'), $cache_file_name = 'a_file', $refresh = true, $width = 900, $height = 500)
 {
     global $log, $current_user;
     $log->debug("Entering pipeline_by_lead_source(" . $legends . ") method ...");
     global $app_strings, $lang_crm, $current_module_strings, $log, $charset, $tmp_dir;
     global $theme;
     include_once 'Image/Graph.php';
     include_once 'Image/Canvas.php';
     $font = calculate_font_name($lang_crm);
     if (!file_exists($cache_file_name) || !file_exists($cache_file_name . '.map') || $refresh == true) {
         $log =& LoggerManager::getLogger('opportunity charts');
         $log->debug("starting pipeline chart");
         $log->debug("legends is:");
         $log->debug($legends);
         $log->debug("user_id is: ");
         $log->debug($user_id);
         $log->debug("cache_file_name is: {$cache_file_name}");
         //Now do the db queries
         //query for opportunity data that matches $legends and $user
         $where = "";
         //build the where clause for the query that matches $datax
         $count = count($legends);
         if ($count > 0) {
             $where .= " leadsource in ( ";
             $ls_i = 0;
             foreach ($legends as $key => $value) {
                 if ($ls_i != 0) {
                     $where .= ", ";
                 }
                 $where .= "'" . addslashes($key) . "'";
                 $ls_i++;
             }
             $where .= ")";
         }
         $opp = new Potentials();
         $opp_list = $opp->get_full_list("vtiger_potential.amount DESC, vtiger_potential.closingdate DESC", $where);
         //build pipeline by lead source data
         $total = 0;
         $count = array();
         $sum = array();
         if (isset($opp_list)) {
             foreach ($opp_list as $record) {
                 if (!isset($sum[$record->column_fields['leadsource']])) {
                     $sum[$record->column_fields['leadsource']] = 0;
                 }
                 if (isset($record->column_fields['amount']) && isset($record->column_fields['leadsource'])) {
                     // Strip all non numbers from this string.
                     $amount = CurrencyField::convertFromMasterCurrency(preg_replace('/[^0-9]/', '', floor($record->column_fields['amount'])), $current_user->conv_rate);
                     $sum[$record->column_fields['leadsource']] = $sum[$record->column_fields['leadsource']] + $amount / 1000;
                     if (isset($count[$record->column_fields['leadsource']])) {
                         $count[$record->column_fields['leadsource']]++;
                     } else {
                         $count[$record->column_fields['leadsource']] = 1;
                     }
                     $total = $total + $amount / 1000;
                 }
             }
         }
         $visible_legends = array();
         $data = array();
         $aTargets = array();
         $aAlts = array();
         foreach ($legends as $lead_source_key => $lead_source_translation) {
             if (isset($sum[$lead_source_key])) {
                 array_push($data, $sum[$lead_source_key]);
                 if ($lead_source_key != '') {
                     array_push($visible_legends, $lead_source_translation);
                 } else {
                     // put none in if the vtiger_field is blank.
                     array_push($visible_legends, $current_module_strings['NTC_NO_LEGENDS']);
                 }
                 $cvid = getCvIdOfAll("Potentials");
                 array_push($aTargets, "index.php?module=Potentials&action=ListView&leadsource=" . urlencode($lead_source_key) . "&query=true&type=dbrd&viewname=" . $cvid);
                 array_push($aAlts, $count[$lead_source_key] . " " . $current_module_strings['LBL_OPPS_IN_LEAD_SOURCE'] . " {$lead_source_translation}\t");
             }
         }
         $log->debug("sum is:");
         $log->debug($sum);
         $log->debug("count is:");
         $log->debug($count);
         $log->debug("total is: {$total}");
         if ($total == 0) {
             $log->debug("Exiting pipeline_by_lead_source method ...");
             return $current_module_strings['ERR_NO_OPPS'];
         }
         if ($theme == "blue") {
             $font_color = "#212473";
         } else {
             $font_color = "#000000";
         }
         $canvas =& Image_Canvas::factory('png', array('width' => $width, 'height' => $height, 'usemap' => true));
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:Charts.php

示例14: horizontal_graph

/** Function to render the Horizontal Graph
 * Portions created by vtiger are Copyright (C) vtiger.
 * All Rights Reserved.
 * Contributor(s): ______________________________________..
 */
function horizontal_graph($referdata, $refer_code, $width, $height, $left, $right, $top, $bottom, $title, $target_val, $cache_file_name, $html_image_name)
{
    global $log, $root_directory, $lang_crm, $theme;
    //We'll be getting the values in the form of a string separated by commas
    $datay = explode("::", $referdata);
    // The datay values
    $datax = explode("::", $refer_code);
    // The datax values
    // The links values are given as string in the encoded form, here we are decoding it
    $target_val = urldecode($target_val);
    $target = explode("::", $target_val);
    $alts = array();
    $temp = array();
    for ($i = 0; $i < count($datax); $i++) {
        $name = $datax[$i];
        $pos = substr_count($name, " ");
        // JFV : prevent utf-8 char garbled and display percentage correctly
        global $default_charset;
        $sum = 0;
        for ($j = 0; $j < count($datay); $j++) {
            $sum += $datay[$j];
        }
        $alts[] = htmlentities($name, ENT_QUOTES, $default_charset) . " = " . sprintf('%0.1f%%', 100 * $datay[$i] / $sum);
        //		$alts[]=htmlentities($name)."=%d";
        // JFV END
        //If the daatx value of a string is greater, adding '\n' to it so that it'll cme inh 2nd line
        if (strlen($name) >= 14) {
            $name = substr($name, 0, 44);
        }
        if ($pos >= 2) {
            $val = explode(" ", $name);
            $n = count($val) - 1;
            $x = "";
            for ($j = 0; $j < count($val); $j++) {
                if ($j != $n) {
                    $x .= " " . $val[$j];
                } else {
                    $x .= "@#" . $val[$j];
                }
            }
            $name = $x;
        }
        $name = str_replace("@#", "\n", $name);
        $temp[] = $name;
    }
    $datax = $temp;
    //datay is the values
    //datax is the status
    // Set the basic parameters of the graph
    $canvas =& Image_Canvas::factory('png', array('width' => $width, 'height' => $height, 'usemap' => true));
    $imagemap = $canvas->getImageMap();
    $graph =& Image_Graph::factory('graph', $canvas);
    $font =& $graph->addNew('font', calculate_font_name($lang_crm));
    // set the font size to 12
    $font->setSize(8);
    if ($theme == "blue") {
        $font_color = "#212473";
    } else {
        $font_color = "#000000";
    }
    $font->setColor($font_color);
    $graph->setFont($font);
    $titlestr =& Image_Graph::factory('title', array($title, 8));
    $plotarea =& Image_Graph::factory('plotarea', array('axis', 'axis', 'horizontal'));
    $graph->add(Image_Graph::vertical($titlestr, $plotarea, 5));
    // Now create a bar plot
    $max = 0;
    // To create unique lables we need to keep track of lable name and its count
    $uniquex = array();
    $xlabels = array();
    $dataset =& Image_Graph::factory('dataset');
    if ($theme == 'woodspice') {
        $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED, '#804000', 'white'));
    } elseif ($theme == 'bluelagoon') {
        $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED, 'blue', 'white'));
    } elseif ($theme == 'softed') {
        $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED, 'blue', 'white'));
    } else {
        $fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL_MIRRORED, 'black', 'white'));
    }
    for ($i = 0; $i < count($datay); $i++) {
        $x = 1 + 2 * $i;
        if ($datay[$i] >= $max) {
            $max = $datay[$i];
        }
        $dataset->addPoint($x, $datay[$i], array('url' => $target[$i], 'alt' => $alts[$i]));
        // build the xaxis label array to allow intermediate ticks
        $xlabels[$x] = $datax[$i];
        $xlabels[$x + 1] = '';
        // To have unique names even in case of duplicates let us add the id
        $datax_appearance = $uniquex[$datax[$i]];
        if ($datax_appearance == null) {
            $uniquex[$datax[$i]] = 1;
        } else {
            $xlabels[$x] = $datax[$i] . ' [' . $datax_appearance . ']';
//.........这里部分代码省略.........
开发者ID:hbsman,项目名称:vtigercrm-5.3.0-ja,代码行数:101,代码来源:horizontal_bargraph.php

示例15: array

 * @link       http://pear.php.net/package/Image_Graph
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(800, 600));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', 'Verdana');
// set the font size to 7 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Testing Changing Axis Label Intervals (Bar Charts also test label distance)', 10)), $Matrix = Image_Graph::factory('Image_Graph_Layout_Matrix', array(4, 4)), 5));
$DS[0] =& Image_Graph::factory('dataset', array(array(0 => 1, 1 => 2, 2 => 0, 3 => 1, 4 => 4)));
$DS[1] =& Image_Graph::factory('dataset', array(array('A' => 1, 'B' => 2, 'C' => 0, 'D' => 1, 'E' => 4)));
$DS[2] =& Image_Graph::factory('dataset', array(array(0 => 1, 1 => 2, 2 => -2, 3 => 1, 4 => 4)));
$DS[3] =& Image_Graph::factory('dataset', array(array('A' => 1, 'B' => 2, 'C' => -2, 'D' => 1, 'E' => 4)));
for ($row = 0; $row < 4; $row++) {
    for ($col = 0; $col < 4; $col++) {
        if (isset($DS[$col])) {
            $Plotarea =& $Matrix->getEntry($row, $col);
            $AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
            $AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
            if ($row > 2) {
                $AxisX->setLabelInterval(3);
                $AxisX->setTitle('"Odd" interval');
            } elseif ($row > 0) {
                $AxisX->setLabelInterval(2);
                $AxisX->setTitle('Changed interval');
            } else {
                $AxisX->setTitle('Default interval');
            }
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:labelinterval.php


注:本文中的Image_Graph::factory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。