本文整理汇总了PHP中PieGraph::DisplayCreationTime方法的典型用法代码示例。如果您正苦于以下问题:PHP PieGraph::DisplayCreationTime方法的具体用法?PHP PieGraph::DisplayCreationTime怎么用?PHP PieGraph::DisplayCreationTime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PieGraph
的用法示例。
在下文中一共展示了PieGraph::DisplayCreationTime方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: UsersChartGB
function UsersChartGB()
{
require 'lib/piegraph.class.php';
global $SAMSConf;
global $DATE;
$DB = new SAMSDB();
$sdate = $DATE->sdate();
$edate = $DATE->edate();
$bdate = $DATE->BeginDate();
$eddate = $DATE->EndDate();
$size = "";
if (isset($_GET["size"])) {
$size = $_GET["size"];
}
if (isset($_GET["sort"])) {
$sort = $_GET["sort"];
}
if (isset($_GET["desc"])) {
$desc = $_GET["desc"];
}
$QUERY = "SELECT sum(s_size) as user_size FROM cachesum WHERE s_date>='{$sdate}' AND s_date<='{$edate}'";
$num_rows = $DB->samsdb_query_value($QUERY);
$row = $DB->samsdb_fetch_array();
$full_utraffic_size = $row['user_size'];
$DB->free_samsdb_query();
$colors = array("#FF0000", "#0000FF", "#FFFF00", "#009000", "#C3690F", "#CC009C", "#99CC33", "#3C3CFF", "#C9960C", "#FF6F00", "#C6C63C", "#CC033C", "#00FFFF", "#636F66", "#6FFF00", "#96693F", "#009C9C", "#FFCC00", "#9F9F6F", "#CC60CC");
$usercolors = array();
if ($sort == "users") {
$QUERY = "SELECT c.s_user,sum(c.s_size) as user_size,sum(c.s_hit) as hit_size, s.s_user_id as s_id FROM cachesum c, squiduser s WHERE c.s_user=s.s_nick AND c.s_date>='{$sdate}' AND c.s_date<='{$edate}' GROUP BY c.s_user, s.s_user_id ORDER BY user_size DESC;";
} else {
$QUERY = "SELECT sum.sum_name as s_user,sum(sum.sum_size) as user_size, sum(sum.sum_hit) as hit_size, sum.sum_group_id as s_id FROM ( SELECT sum(c.s_size) as sum_size, sum(c.s_hit) as sum_hit, c.s_user as sum_user, s.s_group_id as sum_group_id, g.s_name as sum_name FROM cachesum c, squiduser s, sgroup g WHERE c.s_user=s.s_nick AND s.s_group_id=g.s_group_id AND s_date>='{$sdate}' AND s_date<='{$edate}' GROUP BY c.s_user, s.s_group_id, g.s_name ORDER BY g.s_name ) as sum GROUP BY s_user, sum.sum_group_id;";
}
$num_rows = $DB->samsdb_query_value($QUERY);
$count = 0;
$sum_size = 0;
$sum_hit = 0;
$sum_pc = 0;
$another_utraffic_size = 0;
while ($row = $DB->samsdb_fetch_array()) {
if ($row['user_size'] >= $full_utraffic_size / 100) {
if ($count < count($colors)) {
$usercolors[$count] = $colors[$count];
} else {
$r = mt_rand(10, 240);
$g = mt_rand(10, 240);
$b = mt_rand(10, 240);
$usercolors[$count] = "#" . sprintf("%X%X%X", mt_rand(20, 200), mt_rand(20, 200), mt_rand(20, 200));
}
$user[$count] = $row['s_user'];
$size[$count] = $row['user_size'];
$count++;
} else {
$another_utraffic_size += $row['user_size'];
}
}
if ($another_utraffic_size > 0) {
$user[$count] = "another users";
$size[$count] = $another_utraffic_size;
$count++;
}
$pie = new PieGraph(300, 200, $size);
$pie->setColors($usercolors);
// legends for the data
$pie->setLegends($user);
// Display creation time of the graph
$pie->DisplayCreationTime();
// Height of the pie 3d effect
$pie->set3dHeight(15);
// Display the graph
$pie->display();
}