當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Stats::hasData方法代碼示例

本文整理匯總了PHP中Stats::hasData方法的典型用法代碼示例。如果您正苦於以下問題:PHP Stats::hasData方法的具體用法?PHP Stats::hasData怎麽用?PHP Stats::hasData使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Stats的用法示例。


在下文中一共展示了Stats::hasData方法的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

    $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);
// The pie plot
$p1 = new PiePlot($data);
$p1->SetTheme('pastel');
// Move center of pie to the left to make better room
// for the legend
$p1->SetCenter(0.3, 0.55);
// Label font and color setup
開發者ID:juliogallardo1326,項目名稱:proc,代碼行數:31,代碼來源:stats_chart.php


注:本文中的Stats::hasData方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。