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


PHP Image_Graph::vertical方法代码示例

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


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

示例1: Image_Graph_Simple

 /**
  * Image_Graph_Simple [Constructor]
  *
  * @param int    $width     The width of the graph in pixels
  * @param int    $height    The height of the graph in pixels
  * @param ???    $plotType  ???
  * @param ???    $data      ???
  * @param string $title     The title
  * @param string $lineColor Color for lines
  * @param string $fillColor Color for fills
  * @param ???    $font      ???
  */
 function Image_Graph_Simple($width, $height, $plotType, $data, $title, $lineColor = 'black', $fillColor = 'white', $font = false)
 {
     parent::__construct($width, $height);
     $plotarea =& Image_Graph::factory('plotarea');
     $dataset =& Image_Graph::factory('dataset', array($data));
     if ($font === false) {
         $font =& Image_Graph::factory('Image_Graph_Font');
     } elseif (is_string($font)) {
         $font =& Image_Graph::factory('ttf_font', $font);
         $font->setSize(8);
     }
     $this->setFont($font);
     $this->add(Image_Graph::vertical(Image_Graph::factory('title', array($title, array('size_rel' => 2))), $plotarea, 10));
     $plotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_Y);
     $plot =& $plotarea->addNew($plotType, array(&$dataset));
     $plot->setLineColor($lineColor);
     $plot->setFillColor($fillColor);
     $axisX =& $plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
     $axisX->showLabel(IMAGE_GRAPH_LABEL_MINIMUM + IMAGE_GRAPH_LABEL_ZERO + IMAGE_GRAPH_LABEL_MAXIMUM);
 }
开发者ID:richardmansfield,项目名称:richardms-mahara,代码行数:32,代码来源:Simple.php

示例2: getPieChart

 public static function getPieChart($xaxisData, $yaxisData, $title = '', $width = '', $height = '', $charttype = 'vertical', $cachedFileName = false, $target = false, $color = '')
 {
     global $log, $lang_crm, $default_charset;
     require_once 'include/utils/utils.php';
     require_once 'include/utils/GraphUtils.php';
     include_once 'Image/Graph.php';
     include_once 'Image/Canvas.php';
     if ($cachedFileName === false) {
         $cache_file_name = 'cache/images/pie_chart_' . time() . '.png';
     } else {
         $cache_file_name = $cachedFileName;
     }
     if (empty($width)) {
         $width = '500';
     }
     if (empty($height)) {
         $height = '400';
     }
     if ($target === false) {
         $target = array();
     }
     $alts = array();
     $temp = array();
     for ($i = 0; $i < count($xaxisData); $i++) {
         $name = html_entity_decode($xaxisData[$i], ENT_QUOTES, $default_charset);
         $pos = substr_count($name, " ");
         $alts[] = $name;
         //If the datax value of a string is greater, adding '\n' to it so that it'll come in 2nd line
         if (strlen($name) >= 14) {
             $name = substr($name, 0, 34);
         }
         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;
     }
     $xaxisData = $temp;
     $width = $width + $width / 5;
     $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));
     $font->setSize(8);
     $font->setColor($color);
     $graph->setFont($font);
     // create the plotarea layout
     $title =& Image_Graph::factory('title', array($title, 10));
     $plotarea =& Image_Graph::factory('plotarea', array('category', 'axis'));
     $graph->add(Image_Graph::vertical($title, $plotarea, 5));
     // To create unique lables we need to keep track of lable name and its count
     $uniquex = array();
     // Generate colours
     $colors = color_generator(count($yaxisData), '#33DDFF', '#3322FF');
     $dataset =& Image_Graph::factory('dataset');
     $fills =& Image_Graph::factory('Image_Graph_Fill_Array');
     $sum = 0;
     $pcvalues = array();
     for ($i = 0; $i < count($yaxisData); $i++) {
         $sum += $yaxisData[$i];
     }
     for ($i = 0; $i < count($yaxisData); $i++) {
         // To have unique names even in case of duplicates let us add the id
         $datalabel = $xaxisData[$i];
         $xaxisData_appearance = $uniquex[$xaxisData[$i]];
         if ($xaxisData_appearance == null) {
             $uniquex[$xaxisData[$i]] = 1;
         } else {
             $datalabel = $xaxisData[$i] . ' [' . $xaxisData_appearance . ']';
             $uniquex[$xaxisData[$i]] = $xaxisData_appearance + 1;
         }
         $dataset->addPoint($datalabel, $yaxisData[$i], array('url' => $target[$i], 'alt' => $alts[$i] . '=' . sprintf('%0.1f%%', 100 * $yaxisData[$i] / $sum)));
         $pcvalues[$yaxisData[$i]] = sprintf('%0.1f%%', 100 * $yaxisData[$i] / $sum);
         $fills->addColor($colors[$i]);
     }
     if ($sum == 0) {
         return null;
     }
     // create the pie chart and associate the filling colours
     $gbplot =& $plotarea->addNew('pie', $dataset);
     $plotarea->setPadding(array('top' => 0, 'bottom' => 0, 'left' => 0, 'right' => $width / 20));
     $plotarea->hideAxis();
     $gbplot->setFillStyle($fills);
     // format the data values
     $marker_array =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', array($pcvalues));
     // set markers
     $marker =& $graph->addNew('value_marker', IMAGE_GRAPH_VALUE_Y);
     $marker->setDataPreprocessor($marker_array);
     $marker->setFillColor('#FFFFFF');
     $marker->setBorderColor($color);
//.........这里部分代码省略.........
开发者ID:cannking,项目名称:vtigercrm-debug,代码行数:101,代码来源:ChartUtils.php

示例3: array

 * None specific
 * 
 * $Id: plot_step.php,v 1.3 2005/08/03 21:21:52 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(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('Step Chart Sample', 12)), Image_Graph::vertical($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 90), 5));
$Legend->setPlotarea($Plotarea);
// create the dataset
$Dataset[] =& Image_Graph::factory('random', array(10, 2, 5, false));
$Dataset[] =& Image_Graph::factory('random', array(10, 2, 5, false));
$Dataset[] =& Image_Graph::factory('random', array(10, 2, 5, false));
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('Image_Graph_Plot_Step', array($Dataset, 'stacked'));
// set a line color
$Plot->setLineColor('gray');
$Fill =& Image_Graph::factory('Image_Graph_Fill_Array');
$Fill->addColor('red@0.2');
$Fill->addColor('blue@0.2');
$Fill->addColor('green@0.2');
$Plot->setFillStyle($Fill);
// output the Graph
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:plot_step.php

示例4: array

 * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
 * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
 * @version    CVS: $Id: intersection_secondary_axis.php,v 1.5 2005/08/03 21:21:58 nosey Exp $
 * @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 11 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Testing Secondary Axis Intersection', 10)), $Matrix = Image_Graph::factory('Image_Graph_Layout_Matrix', array(3, 3)), 5));
$DS[0] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 2, '2' => 0)));
$DS[1] =& Image_Graph::factory('dataset', array(array('0' => -1, '1' => 2, '2' => 1)));
$DS[2] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 3, '2' => 2)));
$DS2[0] =& Image_Graph::factory('dataset', array(array('0' => -1, '1' => 2, '2' => 1)));
$DS2[1] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 3, '2' => 2)));
$DS2[2] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 2, '2' => 1)));
for ($row = 0; $row < 3; $row++) {
    for ($col = 0; $col < 3; $col++) {
        if (isset($DS[$col])) {
            $Plotarea =& $Matrix->getEntry($row, $col);
            $AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
            $AxisY->setLineColor('silver');
            $AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
            $AxisX->setAxisIntersection($row < 1 ? 0 : 1, IMAGE_GRAPH_AXIS_Y_SECONDARY);
            $AxisX->setTitle("Intersect at\ny2=" . ($row < 1 ? '0' : '1'));
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:intersection_secondary_axis.php

示例5: array

 * 
 * $Id: customize.php,v 1.4 2005/09/08 19:02:17 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(450, 300));
// add a TrueType font
$Font =& $Graph->addNew('font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(8);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Stacked Bar Chart with defined axis properties', 12)), $Plotarea = Image_Graph::factory('plotarea'), 5));
$MarkerX =& $Plotarea->addNew('Image_Graph_Axis_Marker_Area', null, IMAGE_GRAPH_AXIS_X);
$MarkerX->setFillColor('blue@0.3');
$MarkerX->setLineColor('blue@0.3');
$MarkerX->setLowerBound(7);
$MarkerX->setUpperBound(8);
$MarkerY =& $Plotarea->addNew('Image_Graph_Axis_Marker_Area', null, IMAGE_GRAPH_AXIS_Y);
$MarkerY->setFillColor('green@0.3');
$MarkerY->setLineColor('green@0.3');
$MarkerY->setLowerBound(5.2);
$MarkerY->setUpperBound(9.300000000000001);
$MarkerY =& $Plotarea->addNew('Image_Graph_Axis_Marker_Line', null, IMAGE_GRAPH_AXIS_Y);
$MarkerY->setLineColor('red');
$MarkerY->setValue(14.4);
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot1 =& $Plotarea->add(Image_Graph::factory('bar', array($Dataset = array(Image_Graph::factory('random', array(8, 1, 10, false)), Image_Graph::factory('random', array(8, 1, 10, false)), Image_Graph::factory('random', array(8, 1, 10, false))), 'stacked')));
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:customize.php

示例6: pie_chart

/** Function to render the Horizontal Graph */
function pie_chart($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
    $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, " ");
        $alts[] = htmlentities($name) . "=%d";
        //If the datax value of a string is greater, adding '\n' to it so that it'll come in 2nd line
        if (strlen($name) >= 14) {
            $name = substr($name, 0, 34);
        }
        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;
    if ($theme == "blue") {
        $font_color = "#212473";
    } else {
        $font_color = "#000000";
    }
    $width = $width + 140;
    $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 11 pixels
    $font->setSize(8);
    $font->setColor($font_color);
    $graph->setFont($font);
    // create the plotarea layout
    $title =& Image_Graph::factory('title', array($title, 10));
    $plotarea =& Image_Graph::factory('plotarea', array('category', 'axis'));
    $footer =& Image_Graph::factory('title', array('Footer', 8));
    $legend_box =& Image_Graph::factory('legend');
    $graph->add(Image_Graph::vertical($title, $plotarea, 5));
    // To create unique lables we need to keep track of lable name and its count
    $uniquex = array();
    // Generate colours
    $colors = color_generator(count($datay), '#33DDFF', '#3322FF');
    $dataset =& Image_Graph::factory('dataset');
    $fills =& Image_Graph::factory('Image_Graph_Fill_Array');
    $sum = 0;
    for ($i = 0; $i < count($datay); $i++) {
        if (isset($_REQUEST['display_view']) && $_REQUEST['display_view'] == 'MATRIX') {
            $datax[$i] = trim($datax[$i]);
            if (strlen($datax[$i]) <= 10) {
                $datax[$i] = $datax[$i];
            } else {
                $datax[$i] = substr($datax[$i], 0, 10) . "..";
            }
        }
        // To have unique names even in case of duplicates let us add the id
        $datalabel = $datax[$i];
        $datax_appearance = $uniquex[$datax[$i]];
        if ($datax_appearance == null) {
            $uniquex[$datax[$i]] = 1;
        } else {
            $datalabel = $datax[$i] . ' [' . $datax_appearance . ']';
            $uniquex[$datax[$i]] = $datax_appearance + 1;
        }
        $dataset->addPoint($datalabel, $datay[$i], array('url' => $target[$i], 'alt' => $alts[$i]));
        $sum += $datay[$i];
        $fills->addColor($colors[$i]);
    }
    // create an array with % values
    $pcvalues = array();
    for ($i = 0; $i < count($datay); $i++) {
        $pcvalues[$datay[$i]] = sprintf('%0.1f%%', 100 * $datay[$i] / $sum);
    }
    // create the pie chart and associate the filling colours
    $gbplot =& $plotarea->addNew('pie', $dataset);
    $plotarea->setPadding(array('top' => 20, 'bottom' => 0, 'left' => 0, 'right' => 50));
    $plotarea->hideAxis();
    $gbplot->setFillStyle($fills);
    // format the data values
    $marker_array =& Image_Graph::factory('Image_Graph_DataPreprocessor_Array', array($pcvalues));
    // set markers
//.........这里部分代码省略.........
开发者ID:kduqi,项目名称:corebos,代码行数:101,代码来源:pie_graph.php

示例7: array

 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('png', array('width' => 400, 'height' => 300, 'antialias' => 'native'));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
// 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('Spider/Radar Chart Sample', 12)), Image_Graph::vertical($Plotarea = Image_Graph::factory('Image_Graph_Plotarea_Radar'), $Legend = Image_Graph::factory('legend'), 90), 5));
$Legend->setPlotarea($Plotarea);
$Plotarea->addNew('Image_Graph_Grid_Polar', IMAGE_GRAPH_AXIS_Y);
// create the dataset
$DS1 =& Image_Graph::factory('dataset');
$DS1->addPoint('Life', rand(1, 6));
$DS1->addPoint('Universe', rand(1, 6));
$DS1->addPoint('Everything', rand(1, 6));
$DS1->addPoint('Something', rand(1, 6));
$DS1->addPoint('Nothing', rand(1, 6));
$DS1->addPoint('Irrelevevant', rand(1, 6));
$DS2 =& Image_Graph::factory('dataset');
$DS2->addPoint('Life', rand(1, 6));
$DS2->addPoint('Universe', rand(1, 6));
$DS2->addPoint('Everything', rand(1, 6));
$DS2->addPoint('Something', rand(1, 6));
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:plot_radar.php

示例8: array

 * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
 * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
 * @version    CVS: $Id$
 * @link       http://pear.php.net/package/Image_Graph
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(600, 600));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Testing Axis Inversion', 10)), $Matrix = Image_Graph::factory('Image_Graph_Layout_Matrix', array(4, 3)), 5));
$DS[0] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 2, '2' => 0)));
$DS[1] =& Image_Graph::factory('dataset', array(array('0' => -1, '1' => 2, '2' => 2)));
$DS[2] =& Image_Graph::factory('dataset', array(array('0' => 1, '1' => 3, '2' => 2)));
for ($row = 0; $row < 4; $row++) {
    for ($col = 0; $col < 3; $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 >= 1) {
                $AxisY->setInverted(true);
                $AxisY->setTitle('Inverted Y', 'vertical');
            } else {
                $AxisY->setTitle('Normal Y', 'vertical');
            }
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:inversion.php

示例9: error_reporting

 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
error_reporting(E_ALL);
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('cpdf', array('page' => 'A3', 'align' => 'center', 'width' => 600, 'height' => 400));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(7);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Image_Graph Demonstration', 12)), Image_Graph::vertical(Image_Graph::vertical($Plotarea_Weather = Image_Graph::factory('plotarea'), $Legend_Weather = Image_Graph::factory('legend'), 85), Image_Graph::horizontal(Image_Graph::vertical(Image_Graph::vertical(Image_Graph::factory('title', array('Demonstration of Mathematical Functions', 10)), $Plotarea_SinCos = Image_Graph::factory('plotarea', 'axis'), 5), $Legend_SinCos = Image_Graph::factory('legend'), 90), $Plotarea_Car = Image_Graph::factory('plotarea'), 50), 60), 5));
$Legend_Weather->setPlotarea($Plotarea_Weather);
$Legend_Weather->setFontSize(7);
$Legend_SinCos->setPlotarea($Plotarea_SinCos);
$Legend_SinCos->setFontSize(8);
$GridY_Weather =& $Plotarea_Weather->addNew('line_grid', null, IMAGE_GRAPH_AXIS_Y);
$GridY_Weather->setLineColor('gray@0.1');
$Marker_AverageSpan =& $Plotarea_Weather->addNew('Image_Graph_Axis_Marker_Area', IMAGE_GRAPH_AXIS_Y);
$Marker_AverageSpan->setFillColor('green@0.2');
$Marker_AverageSpan->setLowerBound(3.8);
$Marker_AverageSpan->setUpperBound(11.4);
$Marker_Average =& $Plotarea_Weather->addNew('Image_Graph_Axis_Marker_Line', IMAGE_GRAPH_AXIS_Y);
$Marker_Average->setLineColor('blue@0.4');
$Marker_Average->setValue(7.7);
$Dataset_Rainfall =& Image_Graph::factory('dataset');
$Dataset_Rainfall->addPoint('Jan', 60);
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:driver_pdf.php

示例10: testCompensatedPrioritiesSharpChangingZoneInvetory


//.........这里部分代码省略.........
         $oZone->addAdvert($oAd);
     }
     $result = $oPriorityCompensation->compensatedPriorities($oZone);
     // Perform the iterations
     for ($iteration = 1; $iteration <= $iterations; $iteration++) {
         // Calculate how many impressions will be delivered for each ad
         foreach ($aAds as $adKey => $aAdData) {
             $aDelivered[$adKey] = 0;
         }
         $this->_predictDelivery($aDelivered, $thisZoneImpressions, $aAds, $aChannels, $result, $oPriorityCompensation);
         // Add the new data to the graph of the results
         $bestError = 0;
         $totalError = 0;
         foreach ($aAds as $adKey => $aAdData) {
             $dataSetName = 'oDataSet_Ad' . $adKey . '_RequiredImpressions';
             ${$dataSetName}->addPoint($iteration, $aAds[$adKey]['impressions']);
             $dataSetName = 'oDataSet_Ad' . $adKey . '_AvailableImpressions';
             if (is_null($aAdData['channel'])) {
                 ${$dataSetName}->addPoint($iteration, $thisZoneImpressions);
             } else {
                 ${$dataSetName}->addPoint($iteration, $thisZoneImpressions * $aChannels[$aAdData['channel']]);
             }
             $dataSetName = 'oDataSet_Ad' . $adKey . '_ActualImpressions';
             ${$dataSetName}->addPoint($iteration, $aDelivered[$adKey]);
             if (!is_null($aAdData['channel']) && $thisZoneImpressions * $aChannels[$aAdData['channel']] < $aAds[$adKey]['impressions']) {
                 $bestError += abs($thisZoneImpressions * $aChannels[$aAdData['channel']] - $aAds[$adKey]['impressions']);
             }
             $totalError += abs($oZone->aAdverts[$adKey]->requiredImpressions - $aDelivered[$adKey]);
         }
         $oDataSetBestError->addPoint($iteration, $bestError);
         $oDataSetTotalError->addPoint($iteration, $totalError);
         // Prepare the ads/zone for the next iteration
         $previousZoneImpressions = $thisZoneImpressions;
         if ($iteration == 1) {
             $thisZoneImpressions = $this->_predictSharpZoneInventory($minZoneImpressions, $maxZoneImpressions, $zoneImpressionPeriod, $iteration);
         } else {
             $thisZoneImpressions = $this->_predictSharpZoneInventory($minZoneImpressions, $maxZoneImpressions, $zoneImpressionPeriod, $iteration);
         }
         $oZone = new OX_Maintenance_Priority_Zone(array('zoneid' => 1));
         $oZone->availableImpressions = $thisZoneImpressions;
         foreach ($aAds as $adKey => $aAdData) {
             $oAd = new OA_Maintenance_Priority_Ad(array('ad_id' => $adKey));
             $oAd->requiredImpressions = $aAdData['impressions'];
             $oAd->requestedImpressions = $aAdData['impressions'];
             $oAd->pastRequiredImpressions = $aAdData['impressions'];
             $oAd->pastRequestedImpressions = $aAdData['impressions'];
             $oAd->pastActualImpressions = $aDelivered[$adKey];
             $oAd->pastAdZonePriorityFactor = $result['ads'][$adKey]['priority_factor'];
             $oAd->pastZoneTrafficFraction = $result['ads'][$adKey]['past_zone_traffic_fraction'];
             $oZone->addAdvert($oAd);
         }
         $result = $oPriorityCompensation->compensatedPriorities($oZone);
     }
     // Prepare the graph
     $oCanvas =& Image_Canvas::factory('png', array('width' => 600, 'height' => 480, 'antialias' => false));
     $oGraph =& Image_Graph::factory('graph', $oCanvas);
     if (function_exists('imagettfbbox') && isset($conf['graphs']['ttfName'])) {
         $oFont =& $oGraph->addNew('ttf_font', $conf['graphs']['ttfName']);
         $oFont->setSize(9);
         $oGraph->setFont($oFont);
     }
     $oGraph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Priority Compensation in Fixed Impression Zone', 12)), Image_Graph::vertical($oPlotarea = Image_Graph::factory('plotarea', array('axis', 'axis_log')), $oLegend = Image_Graph::factory('legend'), 80), 10));
     $oLegend->setPlotarea($oPlotarea);
     $oGridLines =& $oPlotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_X);
     $oGridLines =& $oPlotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_Y);
     $oAxis =& $oPlotarea->getAxis(IMAGE_GRAPH_AXIS_X);
     $oAxis->setTitle('Operation Intervals');
     $oAxis =& $oPlotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
     $oAxis->setTitle('Impressions', 'vertical');
     $counter = 1;
     $aAxisLabels = array();
     while ($counter < $maxZoneImpressions) {
         $counter *= 10;
         $aAxisLabels[] = $counter;
     }
     $oAxis->setLabelInterval($aAxisLabels);
     // Ad the data sets to the graph
     foreach ($aAds as $adKey => $aAdData) {
         $dataSetName = 'oDataSet_Ad' . $adKey . '_RequiredImpressions';
         $oPlot =& $oPlotarea->addNew('line', ${$dataSetName});
         $oLineStyle =& Image_Graph::factory('Image_Graph_Line_Dashed', array($aAdData['colour'], 'transparent'));
         $oPlot->setLineStyle($oLineStyle);
         $dataSetName = 'oDataSet_Ad' . $adKey . '_AvailableImpressions';
         $oPlot =& $oPlotarea->addNew('line', ${$dataSetName});
         $oLineStyle =& Image_Graph::factory('Image_Graph_Line_Dotted', array($aAdData['colour'], 'transparent'));
         $oPlot->setLineStyle($oLineStyle);
         $dataSetName = 'oDataSet_Ad' . $adKey . '_ActualImpressions';
         $oPlot =& $oPlotarea->addNew('line', ${$dataSetName});
         $oPlot->setLineColor($aAdData['colour']);
     }
     $oPlot =& $oPlotarea->addNew('line', $oDataSetBestError);
     $oLineStyle =& Image_Graph::factory('Image_Graph_Line_Dotted', array('magenta', 'transparent'));
     $oPlot->setLineStyle($oLineStyle);
     $oPlot =& $oPlotarea->addNew('line', $oDataSetTotalError);
     $oPlot->setLineColor('magenta');
     $oPlotarea->setFillColor('white');
     $filename = "results/" . __CLASS__ . '_' . __FUNCTION__ . ".png";
     $oGraph->done(array('filename' => MAX_PATH . '/tests/' . $filename));
     echo '<img src="' . $filename . '" alt="" />' . "\n";
 }
开发者ID:ballistiq,项目名称:revive-adserver,代码行数:101,代码来源:PriorityCompensation.mtp.test.php

示例11: array

 * None specific
 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
require_once 'Image/Graph.php';
require_once 'Image/Canvas.php';
$Canvas =& Image_Canvas::factory('png', array('width' => 400, 'height' => 200));
// create the graph
$Graph =& Image_Graph::factory('graph', $Canvas);
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(8);
$Graph->setFont($Font);
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Gradient Filled Step Chart', 11)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), Image_Graph::factory('title', array('Anybody recognize?', array('size' => 7, 'color' => 'gray@0.6', 'angle' => 270))), 98), 5));
$Grid =& $Plotarea->addNew('line_grid', array(), IMAGE_GRAPH_AXIS_Y);
$Grid->setLineColor('white@0.4');
$Dataset =& Image_Graph::factory('dataset');
$Dataset->addPoint(1, 20);
$Dataset->addPoint(2, 10);
$Dataset->addPoint(3, 35);
$Dataset->addPoint(4, 5);
$Dataset->addPoint(5, 18);
$Dataset->addPoint(6, 33);
$Plot =& $Plotarea->addNew('step', array(&$Dataset));
$Fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'darkgreen', 'white'));
$Plot->setFillStyle($Fill);
$Fill =& Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'yellow', 'darkred'));
$Plotarea->setFillStyle($Fill);
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:gradient_step.php

示例12: array

 * @author     Jesper Veggerby <pear.nosey@veggerby.dk>
 * @copyright  Copyright (C) 2003, 2004 Jesper Veggerby Hansen
 * @license    http://www.gnu.org/copyleft/lesser.html  LGPL License 2.1
 * @version    CVS: $Id: category.php,v 1.4 2005/08/03 21:21:58 nosey Exp $
 * @link       http://pear.php.net/package/Image_Graph
 */
require_once 'Image/Graph.php';
// create the graph
$Graph =& Image_Graph::factory('graph', array(400, 300));
// add a TrueType font
$Font =& $Graph->addNew('ttf_font', 'Verdana');
// set the font size to 11 pixels
$Font->setSize(7);
$Graph->setFont($Font);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Testing Category Axis', 10)), $Plotarea = Image_Graph::factory('plotarea', array('Image_Graph_Axis_Category', 'Image_Graph_Axis_Category')), 5));
$DS =& Image_Graph::factory('dataset');
$DS->addPoint('Germany', 'England');
$DS->addPoint('Denmark', 'France');
$DS->addPoint('Sweden', 'Denmark');
$DS->addPoint('England', 'France');
$DS->addPoint('Norway', 'Finland');
$DS->addPoint('Denmark', 'Finland');
$DS->addPoint('Iceland', 'Germany');
$DS->addPoint('Norway', 'France');
$DS2 =& Image_Graph::factory('dataset');
$DS2->addPoint('Sweden', 'France');
$DS2->addPoint('Austria', 'Germany');
$DS2->addPoint('Norway', 'Holland');
$DS2->addPoint('Denmark', 'Germany');
$DS2->addPoint('Sweden', 'Holland');
开发者ID:hbustun,项目名称:agilebill,代码行数:31,代码来源:category.php

示例13: array

$Graph =& Image_Graph::factory('graph', array(600, 300));
$Graph->setBackground(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'lightsteelblue', 'papayawhip')));
// create a random dataset to use for demonstrational purposes
$DataSet =& Image_Graph::factory('function', array(1, 9, 'salaries', 8));
$DataSet2 =& Image_Graph::factory('dataset');
$DataSet2->addPoint('CEO', 10);
$DataSet2->addPoint('TAP', 32);
$DataSet2->addPoint('TBF', 13);
$DataSet2->addPoint('ABC', 19);
$DataSet2->addPoint('QED', 26);
// create and set the plot font
$Font =& $Graph->addNew('font', 'Verdana');
$Font->setSize(7);
$Graph->setFont($Font);
// add a plot area in a vertical layout to display a title on top
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Annual income', 11)), Image_Graph::horizontal($Plotarea = Image_Graph::factory('plotarea'), Image_Graph::vertical($Plotarea2 = Image_Graph::factory('plotarea'), $Legend2 = Image_Graph::factory('legend'), 90)), 5), 5);
$Legend2->setPlotarea($Plotarea2);
// create a bar grid and fill it with a gradient fill white->lightgray
$Grid =& $Plotarea->addNew('bar_grid', null, IMAGE_GRAPH_AXIS_Y);
$Grid->setFillColor('gray@0.2');
$Plotarea->setFillColor('gray@0.2');
// add a line plot to the plotarea based on the function dataset
$Plot =& $Plotarea->addNew('line', array(&$DataSet));
// add coins-icon as marker
$Plot->setMarker(Image_Graph::factory('Image_Graph_Marker_Icon', './images/coins.png'));
$AxisX =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_X);
$AxisY =& $Plotarea->getAxis(IMAGE_GRAPH_AXIS_Y);
// make x-axis start at 0
$AxisX->forceMinimum(0);
// make x-axis end at 9
$AxisX->forceMaximum(9);
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:misc02.php

示例14: array

 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
require_once 'Image/Graph.php';
// 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);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Gradient filled smoothed area chart', 12)), Image_Graph::vertical($Plotarea = Image_Graph::factory('plotarea'), $Legend = Image_Graph::factory('legend'), 85), 8));
$Legend->setPlotarea($Plotarea);
// create the 1st dataset
$Dataset =& Image_Graph::factory('random', array(10, 40, 100, true));
// create the 1st plot as smoothed area chart using the 1st dataset
$Plot =& $Plotarea->addNew('smooth_area', array(&$Dataset));
// create a vertical gradient fill using red and yellow, ie bottom of graph
// will be yellow and the 'higher' the value the more red it will be, ie a 'fire' effect
$Plot->setFillStyle(Image_Graph::factory('gradient', array(IMAGE_GRAPH_GRAD_VERTICAL, 'green', 'lightyellow')));
$Plot->setTitle('Inside scope');
// create the 2nd dataset
$Dataset2 =& Image_Graph::factory('random', array(10, 50, 70, true));
// create the 2nd plot as smoothed area chart using the 2nd dataset
$Plot2 =& $Plotarea->addNew('smooth_area', array(&$Dataset2));
// create a vertical gradient fill using red and yellow, ie bottom of graph
// will be yellow and the 'higher' the value the more red it will be, ie a 'fire' effect
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:gradient_fill_area.php

示例15: array

 * 
 * $Id$
 * 
 * @package Image_Graph
 * @author Jesper Veggerby <pear.nosey@veggerby.dk>
 */
require_once 'Image/Graph.php';
// 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);
// create the plotarea
$Graph->add(Image_Graph::vertical(Image_Graph::factory('title', array('Negative Stacked Bar Chart', 10)), $Plotarea = Image_Graph::factory('plotarea'), 5));
$Dataset[0] =& Image_Graph::factory('dataset');
$Dataset[1] =& Image_Graph::factory('dataset');
$Dataset[2] =& Image_Graph::factory('dataset');
$Dataset[0]->addPoint('A', 1);
$Dataset[0]->addPoint('B', 4);
$Dataset[0]->addPoint('C', -1);
$Dataset[0]->addPoint('D', 2);
$Dataset[0]->addPoint('E', 1);
$Dataset[0]->addPoint('F', 2);
$Dataset[0]->addPoint('G', 3);
$Dataset[1]->addPoint('A', 2);
$Dataset[1]->addPoint('B', -3);
$Dataset[1]->addPoint('C', -2);
$Dataset[1]->addPoint('D', 3);
$Dataset[1]->addPoint('E', 3);
开发者ID:Magomogo,项目名称:Image_Graph,代码行数:31,代码来源:plot_bar_stacked_negative.php


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