本文整理汇总了PHP中graph::pie方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::pie方法的具体用法?PHP graph::pie怎么用?PHP graph::pie使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::pie方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: PN_BlogStatisticsProcess
function PN_BlogStatisticsProcess($target)
{
global $blogid, $pluginURL, $defaultURL, $blog;
if (doesHaveOwnership()) {
include_once 'lib/open-flash-chart.php';
$grpStyle = $_GET['grpStyle'];
$grpData = explode("|", $_GET['grpData']);
$grpTotal = $_GET['grpTotal'];
$grpYear = $_GET['grpYear'];
$grpTypeName = $_GET['grpTypeName'];
$grpLinkType = $_GET['grpLinkType'];
$grpXLabelType = isset($_GET['grpXLabelType']) ? $_GET['grpXLabelType'] : 0;
$grpLabel = explode("|", $_GET['grpLabel']);
$grpSubTitle = array();
$grpLabelTemp = array();
if (!empty($_GET['grpData'])) {
if ($grpTypeName == "category") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode($grpLabel[$i] == 0 ? _t('분류없음') : htmlspecialchars(UTF8::lessenAsEm(getCategoryNameById($blogid, $grpLabel[$i]), 15)));
}
} else {
if ($grpTypeName == "hits" || $grpTypeName == "cmmax" || $grpTypeName == "tbmax" || $grpTypeName == "tagmax") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode(htmlspecialchars(UTF8::lessenAsEm(str_replace(",", "-", getEntryTitleById($blogid, $grpLabel[$i])), 25)));
}
} else {
if ($grpTypeName == "commenter" || $grpTypeName == "tag") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 6, ''));
}
$grpLabel = $grpLabelTemp;
} else {
if ($grpTypeName == "time") {
for ($i = 0; $i < count($grpLabel); $i++) {
$grpSubTitle[] = rawurlencode($grpLabel[$i] . "시");
}
} else {
if ($grpTypeName == "refer") {
for ($i = 0; $i < count($grpLabel); $i++) {
$tmpHost = explode('.', $grpLabel[$i]);
$tmpHostCnt = count($tmpHost) - 1;
$tmpDomain = (strlen($tmpHost[$tmpHostCnt]) < 3 ? $tmpHost[$tmpHostCnt - 2] . '.' : '') . $tmpHost[$tmpHostCnt - 1] . '.' . $tmpHost[$tmpHostCnt];
$cutDomain = explode('.', $tmpDomain);
$grpSubTitle[] = htmlspecialchars($grpLabel[$i]);
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($cutDomain[0], 6, ''));
}
$grpLabel = $grpLabelTemp;
} else {
if ($grpTypeName == "referkey") {
for ($i = 0; $i < count($grpLabel); $i++) {
$tmpLabel = explode('(', $grpLabel[$i]);
$grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
$grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($tmpLabel[0], 6, ''));
}
$grpLabel = $grpLabelTemp;
}
}
}
}
}
}
$g = new graph();
$g->bg_colour = '#FFFFFF';
if ($grpStyle == "pie") {
$grpClickLink = "";
$grpPercent = array();
$grpLink = array();
for ($i = 0; $i < count($grpData); $i++) {
$grpPercent[] = round($grpData[$i] / $grpTotal * 100, 0);
}
if ($grpLinkType == "archiveYear") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . "/archive/" . substr($grpLabel[$i], 0, 4);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "archiveMonth" && $grpYear != "9999") {
for ($i = 0; $i < count($grpLabel); $i++) {
$cutMonth = str_replace("월", "", $grpLabel[$i]);
$tmpMonth = strlen($cutMonth) == 1 ? "0" . $cutMonth : $cutMonth;
$permalink = $defaultURL . "/archive/" . $grpYear . $tmpMonth;
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "category") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . "/category/" . getCategoryLabelById($blogid, $grpLabel[$i]);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
} else {
if ($grpLinkType == "entry") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . ($blog['useSlogan'] ? "/entry/" . getEntrySloganById($blogid, $grpLabel[$i]) : "/" . $grpLabel[$i]);
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
//.........这里部分代码省略.........
示例2: graph
for($i = 0; $i < $total; $i ++) {
if (( int ) $_GET ['quantidade' . $i] > 0) {
$_nomes [$i] = $_GET ['nome' . $i];
$_quantidade [$i] = ( int ) $_GET ['quantidade' . $i];
}
}
require 'library/open-flash-chart.php';
$g = new graph ( );
//
// PIE chart, 60% alpha
//
$g->pie ( 60, '#FFFFFF' );
$g->bg_colour = '#FFFFFF';
//
// pass in two arrays, one of data, the other data labels
//
$g->pie_values ( $_quantidade, $_nomes );
//
// Colours for each slice, in this case some of the colours
// will be re-used (3 colurs for 5 slices means the last two
// slices will have colours colour[0] and colour[1]):
//
$g->pie_slice_colours ( $_CONF['COLORS'] );
$g->set_tool_tip ( '#x_label#<br>#val# itens' );
$g->title ( '', '' );
示例3: graph
$g->y_axis_colour('#909090', '#D2D2FB');
$g->set_y_min(0);
$g->set_y_max(max_tab($cat_annee));
$g->y_label_steps(6);
$g->set_y_legend('Open Flash Chart', 12, '#736AFF');
$g->set_width(650);
$g->set_height(400);
$g->set_output_type('js');
$ofc3 = $g->render();
/***********************************/
/************* Camembert sur l'année de toutes les catégories ***************************/
$pie = new graph();
//
// PIE chart, 60% alpha
//
$pie->pie(60, '#505050', '{font-size: 12px; color: #404040;');
//
// pass in two arrays, one of data, the other data labels
//
$label = array();
$data = array();
$color = array();
foreach ($cat_fils_annee as $key => $value) {
$label[] = $key;
$data[] = $value;
$id = $oCat->getId($key);
$color[] = $oCat->getColor($id);
$val = $oCat->getId($key);
if (sizeof($oCat->getAllChildren($val)) == 0) {
$links[] = "javascript:alert('Cette categorie n a pas de sous-categorie')";
} else {
示例4: action_admin_return_ofc_hitrates
/**
* action_admin_return_ofc_hitrates()
*
* the function returns dynamic data (hitrate of apc) and visualizes an piechart with ofc.
* function consists of 4 segments:
* (1) get data
* (2) init ofc
* (3) draw the chart
* (4) render it
*
* @return dynamic data for an open flash chart
*/
public function action_admin_return_ofc_hitrates()
{
/**
* (1) get DATA for Visualization
*/
// get apc cache
$cache_apc = Clansuite_Cache_Factory::getCache('apc');
$apc_stats = $cache_apc->stats();
// debug display of the stats data
// var_dump($apc_stats);
// setup the data array
$data = array();
$data[] = $apc_stats['cache_info']['num_hits'];
$data[] = $apc_stats['cache_info']['num_misses'];
/**
* (2) initialize Open Flash Chart
*/
include 'libraries/open-flash-chart/php-ofc-library/open-flash-chart.php';
$g = new graph();
/**
* (3) draw the ofc chart
*/
// title
$g->title('APC Hitrate', '{font-size:18px; color: #d01f3c}');
// ok, now draw one piece of the pie :)
$g->pie(60, '#505050', '{font-size: 11px; color: #404040;');
/**
* we have to pass in 2 arrays
* (1) $data
* (2) labels for the data
*/
$g->pie_values($data, array('Hits', 'Misses'));
// colours for each slice (hits = green, misses = red)
$g->pie_slice_colours(array('#acb132', '#d01f3c'));
// mouseover tooltip displayes the values
$g->set_tool_tip('#val#');
/**
* (4) output/generate the dynamic data for the swf
*/
echo $g->render();
// eject here unnicely, because of headers exist error
// @todo debug and find out, where after $g->render any output is done
exit;
}
示例5: max
}
if ($type == 'line'){
$g->set_data($data);
$g->line_hollow( 2, 4, '#5E83BF', 'Documentos', 10 );
$g->set_x_labels($labels);
$g->set_x_label_style( 10, '0x000000', 0, 2 );
$g->set_y_max( max($data) );
$g->y_label_steps(4);
}else if ($type == 'pie'){
$g->pie(60,'#505050','{font-size: 11px; color: #404040}');
$g->pie_values( $data, $labels );
$g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#FFCC99','#009933','#FF99FF','#33FFFF','#CCCC99','#330033','#00CCFF','#CCCCCC','#FFCC00','#FF0033','#660000','#FFCCCC','#33FF33','#FF6633' ) );
}else{
$bar = new bar( 95, '#5E83BF', '#424581' );
//$bar->key( 'documentos', 10 );
$bar->data = $data;
// set the X axis labels
$g->set_x_labels( $labels );
//$g->set_data( $data );
示例6: return_ofc_cc
function return_ofc_cc()
{
global $cms, $ps, $pie_slice_colors;
$styles =& $cms->theme->styles;
$max = 8;
// 2 less than the real max (10)
$data = array();
$labels = array();
$exclude = array();
$total = 0;
$ps->db->query("SELECT pp.cc,cn,COUNT(*) " . "FROM {$ps->t_plr_profile} pp, {$ps->t_geoip_cc} cc " . "WHERE pp.cc IS NOT NULL AND cc.cc=pp.cc " . "GROUP BY pp.cc " . "ORDER BY 3 DESC LIMIT {$max}");
while (list($cc, $cn, $cctotal) = $ps->db->fetch_row(0)) {
$total += $cctotal;
$data[] = $cctotal;
$labels[] = '(' . strtoupper($cc) . ") {$cn}";
$exclude[] = $cc;
}
// get 'other' CC's that were not not in the top <$max>
list($cctotal) = $ps->db->fetch_list("SELECT COUNT(*) " . "FROM {$ps->t_plr_profile} pp, {$ps->t_geoip_cc} cc " . "WHERE pp.cc IS NOT NULL AND cc.cc=pp.cc AND NOT pp.cc IN (" . implode(',', array_map(create_function('$s', 'global $ps; return $ps->db->escape($s,true);'), $exclude)) . ") ");
$data[] = $cctotal;
$labels[] = $cms->trans("Other");
$otheridx = count($data) - 1;
/**/
// get a count of players that have no CC defined
list($cctotal) = $ps->db->fetch_list("SELECT COUNT(*) " . "FROM {$ps->t_plr_profile} pp " . "WHERE pp.cc IS NULL ");
$data[] = $cctotal;
$labels[] = $cms->trans("Unknown");
/**/
$total = array_sum($data);
// combine any values that are <= 1%
if ($otheridx) {
$extra = 0;
for ($i = 0; $i < $otheridx; $i++) {
if ($data[$i] / $total * 100 <= 1.0) {
$data[$otheridx] += $data[$i];
unset($data[$i], $labels[$i]);
}
}
}
// calculate percentages for each value (the OFC pie function only accepts percentages, not absolute values.....)
$values = array();
foreach ($data as $d) {
$v = sprintf("%0.1f", $d / $total * 100);
if (fmod($v, 1) == 0) {
$v = round($v);
}
$values[] = $v;
}
include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
$g = new graph();
$g->bg_colour = $styles->val('flash.pie.bgcolor', 'flash.bgcolor');
$g->title($styles->val('flash.pie.title', $cms->trans('Country Breakdown'), true), '{' . $styles->val('flash.pie.title.style', 'font-size: 16px', true) . '}');
$g->pie(75, $styles->val('flash.pie.slices.border', '#505050', true), '{' . $styles->val('flash.pie.labels.style', 'font-size: 12px; display: none', true) . '}');
$g->pie_values($values, $labels);
$g->pie_slice_colours($styles->attr_list('flash.pie.slices.slice', 'color', $pie_slice_colors, true));
$g->set_tool_tip($styles->val('flash.pie.tooltip', '#x_label#<br>#val#%', true));
// display the data
print $g->render();
}
示例7: CasesByProcessPie
function CasesByProcessPie()
{
$g->bg_colour = '#FFFFFF';
$dataSet = $this->getCasesByProcess();
$data = $dataSet['data'];
$g = new graph();
$g->pie(80, '#505050', '{font-size: 12px; color: #404040;');
$g->pie_values($data, $dataSet['labelPie']);
$g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810', '#D54C78'));
$g->set_tool_tip('#val# #x_label#');
$g->title('Cases by Process', '{font-size:16px; color: #d01f3c}');
echo $g->render();
}
示例8: ChartPIE
function ChartPIE()
{
$iduser = $_SESSION["SN_b80bb7740288fda1f201890375a60c8f"];
$data = $this->mValues;
$label = $this->mLabels;
$g = new graph();
//
// PIE chart, 60% alpha
//
//$g->set_swf_path(vIMG_PATH . "/tmp/");
$g->pie(60, '#505050', '{font-size: 10px; color: #404040;');
//
// pass in two arrays, one of data, the other data labels
//
$g->pie_values($data, $label);
//
// Colours for each slice, in this case some of the colours
// will be re-used (3 colurs for 5 slices means the last two
// slices will have colours colour[0] and colour[1]):
//
if ($this->mColor == false) {
$lim = sizeof($data);
$colorInit = hexdec("d01f3c");
$this->mColor = array();
for ($i = 0; $i < $lim; $i++) {
$colorInit += floor($i * rand(-255, 255));
$this->mColor[] = "#" . dechex($colorInit);
}
}
$g->pie_slice_colours($this->mColor);
$g->set_tool_tip('#val#%');
$g->title($this->mTitle, '{font-size:14px; color: #d01f3c}');
$x = $g->render();
return $this->setWriteFile($x);
}
示例9: array
/* } else {
$closed = 'null';
}*/
/*}*/
/*echo "1 > ".$new."<br>2 > ".$inprogress."<br>3 >".$overdue."<br>4 >".$closed;
exit;
*/
$data = array('' . number_format($closed, 0) . '', '' . number_format($new, 0) . '', '' . number_format($inprogress, 0) . '', '' . number_format($overdue, 0) . '');
$links = array('myoverdue.php', 'mynew.php', 'myinprogress.php', 'myclosed.php');
/*$data = array(''.number_format($closed,2).'','10','10','10');
$links = array('myclosed.php','null','null','null');*/
include_once 'php-ofc-library/open-flash-chart.php';
$g = new graph();
//
// PIE chart, 60% alpha
//
$g->pie(95, '#ffffff', '{font-size: 12px; color: #404040;');
//
// pass in two arrays, one of data, the other data labels
//
$g->pie_values($data, array('' . $lbl_closed . '', '' . $lbl_new . '', '' . $lbl_inprogress . '', '' . $lbl_overdue . ''), $links);
//
// Colours for each slice, in this case some of the colours
// will be re-used (3 colurs for 5 slices means the last two
// slices will have colours colour[0] and colour[1]):
//
$g->pie_slice_colours(array('#009900', '#356aa0', '#C79810', '#ff0000'));
$g->bg_colour = '#ffffff';
$g->set_tool_tip('#x_label#:#val#%');
//$g->title( 'My Tasks', '{font-size:18px; color: #d01f3c}' );
echo $g->render();
示例10: BugsOpenByUserFlash
function BugsOpenByUserFlash()
{
$dataSet = $this->getBugsOpenByUser();
$data = $dataSet['data'];
$g = new graph();
$g->bg_colour = '#EFFFEF';
$g->title(' Posts by User last week ' . date("Y-m-d"), '{font-size: 16px;}');
$g->pie(70, '#505050', '{font-size: 12px; color: #404040;');
$g->pie_values($data, $dataSet['label']);
$g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810'));
$g->set_tool_tip('#val# #x_label#');
$g->title('Bugs by Status', '{font-size:18px; color: #d01f3c}');
echo $g->render();
/*
$dataSet = $this->getBugsOpenByUser();
$data = $dataSet['data'];
$g = new graph();
$g->pie(80,'#505050','{font-size: 12px; color: #404040;');
$g->pie_values( $data, $dataSet['label'] );
$g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#D54C78') );
$g->set_tool_tip( '#val# #x_label#' );
$g->title( 'Open Bugs by User', '{font-size:18px; color: #d01f3c}' );
echo $g->render();*/
}
示例11: microtime
srand ( ( double ) microtime () * 1000000 );
require 'library/open-flash-chart.php';
$g = new graph ( );
$total = (int)$_GET['total'];
$_nomes = array ();
$_quantidade = array ();
for($i = 0; $i < $total; $i ++) {
if (( int )$_GET['quantidade'.$i] > 0) {
$_nomes[$i] = qtdCaracteres($_GET['nome'.$i],40);
$_quantidade[$i] = (int)$_GET['quantidade'.$i];
$links[$i] = "javascript:carrega_dadosfornecedor('".(int)$_GET['id'.$i]."')";
}
}
$g->bg = '#484848';
$g->pie ( 60, '#484848', '#555555', true, 1 );
$g->bg_colour = '#FFFFFF';
$g->pie_values ( $_quantidade, $_nomes, $links );
$g->pie_slice_colours ( $_CONF['COLORS'] );
$g->set_tool_tip ( '#x_label#<br>#val# produtos' );
echo $g->render ();
?>