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


PHP ezcGraphPieChart::renderToOutput方法代码示例

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


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

示例1: graph_pie

function graph_pie($p_metrics, $p_title = '', $p_graph_width = 500, $p_graph_height = 350, $p_center = 0.4, $p_poshorizontal = 0.1, $p_posvertical = 0.09)
{
    $t_graph_font = graph_get_font();
    error_check(is_array($p_metrics) ? array_sum($p_metrics) : 0, $p_title);
    if (plugin_config_get('eczlibrary') == ON) {
        $graph = new ezcGraphPieChart();
        $graph->title = $p_title;
        $graph->background->color = '#FFFFFF';
        $graph->options->font = $t_graph_font;
        $graph->options->font->maxFontSize = 12;
        $graph->legend = false;
        $graph->data[0] = new ezcGraphArrayDataSet($p_metrics);
        $graph->data[0]->color = '#FFFF00';
        $graph->renderer = new ezcGraphRenderer3d();
        $graph->renderer->options->dataBorder = false;
        $graph->renderer->options->pieChartShadowSize = 10;
        $graph->renderer->options->pieChartGleam = 0.5;
        $graph->renderer->options->pieChartHeight = 16;
        $graph->renderer->options->legendSymbolGleam = 0.5;
        $graph->driver = new ezcGraphGdDriver();
        //$graph->driver->options->supersampling = 1;
        $graph->driver->options->jpegQuality = 100;
        $graph->driver->options->imageFormat = IMG_JPEG;
        $graph->renderer->options->syncAxisFonts = false;
        $graph->renderToOutput($p_graph_width, $p_graph_height);
    } else {
        $graph = new PieGraph($p_graph_width, $p_graph_height);
        $graph->img->SetMargin(40, 40, 40, 100);
        $graph->title->Set($p_title);
        $graph->title->SetFont($t_graph_font, FS_BOLD);
        $graph->SetMarginColor('white');
        $graph->SetFrame(false);
        $graph->legend->Pos($p_poshorizontal, $p_posvertical);
        $graph->legend->SetFont($t_graph_font);
        $p1 = new PiePlot3d(array_values($p_metrics));
        // should be reversed?
        $p1->SetTheme('earth');
        # $p1->SetTheme("sand");
        $p1->SetCenter($p_center);
        $p1->SetAngle(60);
        $p1->SetLegends(array_keys($p_metrics));
        # Label format
        $p1->value->SetFormat('%2.0f');
        $p1->value->Show();
        $p1->value->SetFont($t_graph_font);
        $graph->Add($p1);
        if (helper_show_query_count()) {
            $graph->subtitle->Set(db_count_queries() . ' queries (' . db_time_queries() . 'sec)');
            $graph->subtitle->SetFont($t_graph_font, FS_NORMAL, 8);
        }
        $graph->Stroke();
    }
}
开发者ID:kaos,项目名称:mantisbt,代码行数:53,代码来源:graph_api.php

示例2: testRenderSmallPieChartToOutput

 public function testRenderSmallPieChartToOutput()
 {
     $filename = $this->tempDir . __FUNCTION__ . '.svg';
     $chart = new ezcGraphPieChart();
     $chart->data['Skien'] = new ezcGraphArrayDataSet(array('Norwegian' => 10, 'Dutch' => 3, 'German' => 2, 'French' => 2, 'Hindi' => 1, 'Taiwanese' => 1, 'Brazilian' => 1, 'Venezuelan' => 1, 'Japanese' => 1, 'Czech' => 1, 'Hungarian' => 1, 'Romanian' => 1));
     ob_start();
     // Suppress header already sent warning
     @$chart->renderToOutput(500, 200);
     file_put_contents($filename, ob_get_clean());
     $this->compare($filename, $this->basePath . 'compare/' . __CLASS__ . '_' . __FUNCTION__ . '.svg');
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:11,代码来源:pie_test.php

示例3: generateOSVersionDistributionGraph


//.........这里部分代码省略.........
     $criteria->select = 'os_name_reg, COUNT(*) as cnt';
     $criteria->order = 'cnt DESC';
     $criteria->group = 'os_name_reg';
     $criteria->compare('t.project_id', $curProjectId);
     $curVer = '(not set)';
     $versions = Yii::app()->user->getCurProjectVersions($curVer);
     if ($curVer != -1) {
         $criteria->compare('appversion_id', $curVer == 0 ? null : $curVer);
     }
     $data = array();
     $models = CrashReport::model()->findAll($criteria);
     $totalCount = 0;
     foreach ($models as $model) {
         $totalCount += $model->cnt;
     }
     $itemCount = 0;
     $others = 0;
     foreach ($models as $model) {
         $itemCount++;
         if ($itemCount > 10) {
             $others += $model->cnt;
             continue;
         }
         $osName = strlen($model->os_name_reg) != 0 ? $model->os_name_reg : "(not set)";
         $percent = 100 * $model->cnt / $totalCount;
         $label = sprintf('(%0.1f%%) %s', $percent, $osName);
         $label = MiscHelpers::addEllipsis($label, 60);
         if (array_key_exists($label, $data)) {
             $data[$label] += $model->cnt;
         } else {
             $data[$label] = $model->cnt;
         }
     }
     if ($others > 0) {
         // Add 'Others'
         $percent = 100 * $others / $totalCount;
         $label = sprintf('(%0.1f%%) Others', $percent);
         $data[$label] = $others;
     }
     // Check the case when $data is empty.
     if (count($data) == 0) {
         // Open out file
         if ($file != null) {
             $fout = @fopen($file, 'w');
             if ($fout == false) {
                 @unlink($tmpfile);
                 throw new CHttpException(403, 'Invalid file.');
             }
         }
         // No data available
         $fileName = Yii::app()->basePath . '/../images/no_data_available.png';
         if ($fd = @fopen($fileName, "r")) {
             $fsize = filesize($fileName);
             // Write HTTP headers
             header("Content-type: image/png");
             //header("Content-Disposition: filename=\"".$fileName."\"");
             header("Content-length: {$fsize}");
             header("Cache-control: private");
             //use this to open files directly
             // Write file content
             while (!feof($fd)) {
                 $buffer = fread($fd, 2048);
                 if ($file == null) {
                     echo $buffer;
                 } else {
                     fwrite($fout, $buffer);
                 }
             }
             if ($file != null) {
                 fclose($fout);
             }
             fclose($fd);
         }
         return;
     }
     $graph = new ezcGraphPieChart();
     $graph->palette = new ezcGraphPaletteEzGreen();
     $graph->data['Versions'] = new ezcGraphArrayDataSet($data);
     $graph->legend = true;
     $graph->legend->position = ezcGraph::RIGHT;
     $graph->legend->landscapeSize = 0.5;
     $graph->legend->portraitSize = 0.5;
     $graph->options->sum = $totalCount;
     //$graph->options->summarizeCaption = 'Others';
     $graph->options->label = '%3$.1f%%';
     $graph->options->font->name = 'Tahoma';
     $graph->options->font->maxFontSize = 14;
     $graph->options->font->minFontSize = 1;
     $graph->renderer = new ezcGraphRenderer3d();
     $graph->renderer->options->pieChartRotation = 0.8;
     $graph->renderer->options->pieChartShadowSize = 10;
     //$graph->renderer->options->pieChartGleam = .3;
     //$graph->renderer->options->pieChartGleamColor = '#FFFFFF';
     //$graph->renderer->options->pieChartGleamBorder = 2;
     if ($file === null) {
         $graph->renderToOutput($w, $h);
     } else {
         $graph->render($w, $h, $file);
     }
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:101,代码来源:CrashReport.php

示例4: generateBugStatusDistributionGraph

 /**
  * Generates a crash report version distribution graph for currently 
  * selected project and dumps it to stdout.
  * @param type $w Desired image width.
  * @param type $h Desired image height.
  * @throws CHttpException
  * @return void
  */
 public static function generateBugStatusDistributionGraph($w, $h, $file = null)
 {
     if (!is_numeric($w) || $w <= 0 || $w > 1024) {
         throw new CHttpException(403, 'Invalid parameter');
     }
     if (!is_numeric($h) || $h <= 0 || $h > 960) {
         throw new CHttpException(403, 'Invalid parameter');
     }
     // Get current project info
     $curProjectId = Yii::app()->user->getCurProjectId();
     if ($curProjectId == false) {
         throw new CHttpException(403, 'Invalid parameter');
     }
     $curVer = Yii::app()->user->getCurProjectVer();
     // Prepare data
     $criteria = new CDbCriteria();
     $criteria->select = 'status, COUNT(*) as cnt';
     $criteria->group = 'status';
     $criteria->compare('project_id', $curProjectId);
     $criteria->order = 'status DESC';
     if ($curVer != -1) {
         $criteria->compare('appversion_id', $curVer == 0 ? null : $curVer);
     }
     $data = array();
     $models = Bug::model()->findAll($criteria);
     $totalCount = 0;
     $curVerStr = '';
     foreach ($models as $model) {
         $totalCount += $model->cnt;
         $data[Lookup::item('BugStatus', $model->status)] = $model->cnt;
     }
     // Check the case when $data is empty.
     if (count($data) == 0) {
         // Open out file
         if ($file != null) {
             $fout = @fopen($file, 'w');
             if ($fout == false) {
                 @unlink($tmpfile);
                 throw new CHttpException(403, 'Invalid file.');
             }
         }
         // No data available
         $fileName = Yii::app()->basePath . '/../images/no_data_available.png';
         if ($fd = @fopen($fileName, "r")) {
             $fsize = filesize($fileName);
             // Write HTTP headers
             header("Content-type: image/png");
             //header("Content-Disposition: filename=\"".$fileName."\"");
             header("Content-length: {$fsize}");
             header("Cache-control: private");
             //use this to open files directly
             // Write file content
             while (!feof($fd)) {
                 $buffer = fread($fd, 2048);
                 if ($file == null) {
                     echo $buffer;
                 } else {
                     fwrite($fout, $buffer);
                 }
             }
             if ($file != null) {
                 fclose($fout);
             }
             fclose($fd);
         }
         return;
     }
     $graph = new ezcGraphPieChart();
     $graph->palette = new ezcGraphPaletteEzRed();
     $graph->data['Versions'] = new ezcGraphArrayDataSet($data);
     $graph->legend = true;
     $graph->legend->position = ezcGraph::RIGHT;
     $graph->options->font->name = 'Tahoma';
     $graph->options->sum = $totalCount;
     $graph->options->summarizeCaption = 'Others';
     $graph->renderer->options->pieChartGleam = 0.3;
     $graph->renderer->options->pieChartGleamColor = '#FFFFFF';
     $graph->renderer->options->pieChartGleamBorder = 2;
     $graph->renderer = new ezcGraphRenderer3d();
     $graph->renderer->options->pieChartRotation = 0.8;
     $graph->renderer->options->pieChartShadowSize = 10;
     if ($file === null) {
         $graph->renderToOutput($w, $h);
     } else {
         $graph->render($w, $h, $file);
     }
 }
开发者ID:xyzz,项目名称:CrashFix,代码行数:95,代码来源:Bug.php

示例5: draw_pie_chart

function draw_pie_chart($WIDTH, $HEIGHT, $DATA, $CONFIG, $LEGEND, $FONT, $PALETTE = 'default')
{
    $palettename = return_palette_name($PALETTE);
    require dirname(__FILE__) . '/lib/ezc/Graph/mahara/palettes/' . $palettename . '.php';
    $graph = new ezcGraphPieChart();
    $paletteclass = generate_palette_class_name($palettename);
    $graph->palette = new $paletteclass();
    $graph->title = $CONFIG['title'];
    $graph->subtitle = 'Created: ' . $CONFIG['ctime'] . ', modified: ' . $CONFIG['mtime'];
    $graph->subtitle->position = ezcGraph::BOTTOM;
    $graph->legend = false;
    $graph->background->padding = 10;
    $graph->driver = new ezcGraphGdDriver();
    $graph->driver->options->imageFormat = IMG_PNG;
    switch ($FONT['type']) {
        case 'serif':
            $fontname = 'lib/ezc/Graph/mahara/fonts/LiberationSerif-Regular.ttf';
            break;
        case 'sans':
            $fontname = 'lib/ezc/Graph/mahara/fonts/LiberationSans-Regular.ttf';
            break;
    }
    $graph->options->font = $fontname;
    switch ($CONFIG['labeltype']) {
        case 'labelonly':
            $label = '%1$s';
            break;
        case 'valueonly':
            $label = '%2$d';
            break;
        case 'value':
            $label = '%1$s: %2$d';
            break;
        case 'percentonly':
            $label = '%3$.1f%%';
            break;
        case 'percent':
            $label = '%1$s: %3$.1f%%';
            break;
        default:
            $label = '%1$s: %2$d (%3$.1f%%)';
    }
    $graph->options->label = $label;
    // Set the maximum font size for all chart elements
    $graph->options->font->maxFontSize = $FONT['size'];
    // Set the font size for the title independently to 14
    $graph->title->font->maxFontSize = $FONT['titlesize'];
    $EZCDATA = array();
    foreach ($DATA as $value) {
        $EZCDATA = array_merge($EZCDATA, array($value['key'] => $value['value']));
        /*
        if ($LEGEND == 'key') { $EZCDATA = array_merge($EZCDATA, array($value['key'] => $value['value'])); }
        if ($LEGEND == 'label') { $EZCDATA = array_merge($EZCDATA, array($value['label'] => $value['value'])); }
        */
    }
    $graph->data[$CONFIG['title']] = new ezcGraphArrayDataSet($EZCDATA);
    if (strtolower($CONFIG['chartspace']) == '3d') {
        $graph->renderer = new ezcGraphRenderer3d();
        $graph->renderer->options->pieChartOffset = 60;
        $graph->renderer->options->pieChartShadowSize = 8;
        $graph->renderer->options->pieChartShadowColor = '#000000';
        //#BABDB6
        $graph->renderer->options->pieChartHeight = 20;
    }
    /* Build the PNG file and send it to the web browser */
    $graph->renderToOutput($WIDTH, $HEIGHT);
}
开发者ID:gbleydon,项目名称:mahara-survey,代码行数:67,代码来源:chart.php

示例6: ezcGraphPieChart

<?php

require_once 'tutorial_autoload.php';
$graph = new ezcGraphPieChart();
$graph->title = 'Access statistics';
$graph->data['Access statistics'] = new ezcGraphArrayDataSet(array('Mozilla' => 19113, 'Explorer' => 10917, 'Opera' => 1464, 'Safari' => 652, 'Konqueror' => 474));
$graph->data['Access statistics']->highlight['Opera'] = true;
$graph->renderToOutput(400, 150);
开发者ID:madscientist159,项目名称:Graph,代码行数:8,代码来源:tutorial_output.php

示例7: COUNT

<?php

$Module = $Params['Module'];
$object_id = $Params['ObjectID'];
$node = eZContentObject::fetch($object_id);
if (!$node || !$node->canRead()) {
    return $Module->handleError(eZError::KERNEL_NOT_AVAILABLE, 'kernel');
}
$db = eZDB::instance();
$sql = "SELECT COUNT(sent) as Sent, COUNT(opened) as Opened FROM jaj_newsletter_delivery WHERE contentobject_id=" . $node->ID;
//, COUNT(viewed) as Viewed
$data = $db->arrayQuery($sql);
$data = $data[0];
$data['Sent'] -= $data['Opened'];
// + $data['Viewed']
$graph = new ezcGraphPieChart();
$graph->title = 'Newsletter Activity';
$graph->legend = false;
$graph->data['Newsletter Activity'] = new ezcGraphArrayDataSet($data);
$graph->data['Newsletter Activity']->highlight['Opened'] = true;
//$graph->data['Newsletter Activity']->highlight['Viewed'] = true;
// select count(sent) as sent, count(opened) as opened, count(viewed) as viewed from jaj_newsletter_delivery where contentobject_id=947;
$graph->renderToOutput(400, 240);
eZExecution::cleanExit();
//$graph->render( 400, 150, 'tutorial_simple_pie.svg' );
//print_r( $rows );
//select date(FROM_UNIXTIME(modified)) as date, state, count(uuid) as count from jaj_newsletter_subscription group by date,state;
开发者ID:jjohnsen,项目名称:jaj_newsletter,代码行数:27,代码来源:graph.php


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