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


PHP Stats::getAssocCategory方法代码示例

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


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

示例1: StatsChart

 /**
  * Plot various stats charts
  *
  * @param string $plotType
  * @param bool $hide_closed
  * @return bool return false if no data is available
  */
 public function StatsChart($plotType, $hide_closed)
 {
     // don't bother if user has no access
     $prj_id = Auth::getCurrentProject();
     if (Auth::getCurrentRole() <= User::getRoleID('Reporter') && Project::getSegregateReporters($prj_id)) {
         return false;
     }
     $colors = array();
     switch ($plotType) {
         case 'status':
             $data = Stats::getAssocStatus($hide_closed);
             $graph_title = ev_gettext('Issues by Status');
             // use same colors as defined for statuses
             foreach ($data as $sta_title => $trash) {
                 $sta_id = Status::getStatusID($sta_title);
                 $status_details = Status::getDetails($sta_id);
                 $colors[] = $status_details['sta_color'];
             }
             break;
         case 'release':
             $data = Stats::getAssocRelease($hide_closed);
             $graph_title = ev_gettext('Issues by Release');
             break;
         case 'priority':
             $data = Stats::getAssocPriority($hide_closed);
             $graph_title = ev_gettext('Issues by Priority');
             break;
         case 'user':
             $data = Stats::getAssocUser($hide_closed);
             $graph_title = ev_gettext('Issues by Assignment');
             break;
         case 'category':
             $data = Stats::getAssocCategory($hide_closed);
             $graph_title = ev_gettext('Issues by Category');
             break;
         default:
             return false;
     }
     // check the values coming from the database and if they are all empty, then
     // output a pre-generated 'No Data Available' picture
     if (!Stats::hasData($data)) {
         return false;
     }
     $plot = $this->create(360, 200);
     $plot->SetImageBorderType('plain');
     $plot->SetTitle($graph_title);
     $plot->SetPlotType('pie');
     $plot->SetDataType('text-data-single');
     if ($colors) {
         $plot->SetDataColors($colors);
     }
     $legend = $dataValue = array();
     foreach ($data as $label => $count) {
         $legend[] = $label . ' (' . $count . ')';
         $dataValue[] = array($label, $count);
     }
     $plot->SetDataValues($dataValue);
     foreach ($legend as $label) {
         $plot->SetLegend($label);
     }
     return $plot->DrawGraph();
 }
开发者ID:korusdipl,项目名称:eventum,代码行数:69,代码来源:PlotHelper.php

示例2: elseif

    $scale = 1;
}
if ($HTTP_GET_VARS["plot"] == "status") {
    $data = Stats::getAssocStatus();
    $graph_title = "Issues by Status";
} elseif ($HTTP_GET_VARS["plot"] == "release") {
    $data = Stats::getAssocRelease();
    $graph_title = "Issues by Release";
} elseif ($HTTP_GET_VARS["plot"] == "priority") {
    $data = Stats::getAssocPriority();
    $graph_title = "Issues by Priority";
} elseif ($HTTP_GET_VARS["plot"] == "user") {
    $data = Stats::getAssocUser();
    $graph_title = "Issues by Assignment";
} elseif ($HTTP_GET_VARS["plot"] == "category") {
    $data = Stats::getAssocCategory();
    $graph_title = "Issues by Category";
}
$labels = array_keys($data);
$data = array_values($data);
// check the values coming from the database and if they are all empty, then
// output a pre-generated 'No Data Available' picture
if (!Stats::hasData($data)) {
    readfile(APP_PATH . "images/no_data.gif");
    exit;
}
// A new graph
$graph = new PieGraph(360 * $scale, 200 * $scale, "auto");
// Setup title
$graph->title->Set($graph_title);
$graph->title->SetFont($font, FS_BOLD, 12);
开发者ID:juliogallardo1326,项目名称:proc,代码行数:31,代码来源:stats_chart.php


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