本文整理汇总了PHP中graph::pie_values方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::pie_values方法的具体用法?PHP graph::pie_values怎么用?PHP graph::pie_values使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::pie_values方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: graph
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 ( '', '' );
echo $g->render ();
?>
示例2: 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;
}
示例3: PN_BlogStatisticsProcess
//.........这里部分代码省略.........
$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.";
} else {
if ($grpLinkType == "tag") {
for ($i = 0; $i < count($grpLabel); $i++) {
$permalink = $defaultURL . "/tag/" . $grpLabel[$i];
$grpLink[] = "javascript:window.open('{$permalink}');void(0)";
}
$grpClickLink = "<br>click on the pie.";
}
}
}
}
}
$g->pie(75, '#ffffff', '#000000', false, 1);
$g->pie_values($grpData, $grpLabel, $grpLink, $grpSubTitle);
$g->pie_slice_colours(array('#B9D2E6', '#E2B11C', '#A3CF22', '#EC7122', '#4FC0C0', '#D45E5E', '#A275A2', '#52A7D2', '#9F373B', '#B4ADA5', '#5FC97E', '#CFB85D', '#9DC64E', '#FFAB29', '#E23838', '#43CEA9', '#4CA9D9', '#BA4ECA', '#6C79DA', '#CCCCCC', '#AB5C06', '#C06868', '#5FC97E', 'CFB85D'));
$g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#(#percent#%25)' . $grpClickLink);
} else {
if ($grpStyle == "bar") {
$g->title(' ', '{font-size:12px; color:#000000;margin-top:0px;padding:3px;}');
$g->set_data($grpData);
$g->set_bar_titles($grpSubTitle);
$g->bar_glass(70, '#68B1D9', '#62A0C1', '', 12);
$g->bar_colours(array('#B9D2E6', '#E2B11C', '#A3CF22', '#EC7122', '#4FC0C0', '#D45E5E', '#A275A2', '#52A7D2', '#9F373B', '#B4ADA5', '#5FC97E', '#CFB85D', '#9DC64E', '#FFAB29', '#E23838', '#43CEA9', '#4CA9D9', '#BA4ECA', '#6C79DA', '#CCCCCC', '#AB5C06', '#C06868', '#5FC97E', 'CFB85D'));
$g->x_axis_colour('#909090', '#D2D2FB');
$g->y_axis_colour('#909090', '#D2D2FB');
$g->set_x_labels($grpLabel);
$g->set_x_label_style(10, '#000000', $grpXLabelType, -1);
$g->set_y_label_style(9, '#888888');
$tmp_data_max = floor(Max($grpData) * 1.2);
if ($tmp_y_max = $tmp_data_max % 10) {
$tmp_data_max = $tmp_data_max + (10 - $tmp_y_max);
}
$g->set_y_max($tmp_data_max);
$g->set_y_legend('', 11, '#736AFF');
$g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#');
} else {
if ($grpStyle == "line") {
$g->title('', '{font-size:1px; color:#000000;}');
$g->set_data($grpData);
$g->line_dot(2, 4, '#6FBBC6', _t('최근 7일간 방문자 수'), 11);
// <-- 3px thick + dots
$g->set_x_labels($grpLabel);
$g->set_x_label_style(8, '#333333', $grpXLabelType, -1);
$g->x_axis_colour('#909090', '#e7e7e7');
$g->y_axis_colour('#909090', '#e7e7e7');
$tmp_data_max = floor(Max($grpData) * 1.2);
if ($tmp_y_max = $tmp_data_max % 10) {
$tmp_data_max = $tmp_data_max + (10 - $tmp_y_max);
}
$g->set_y_max($tmp_data_max);
$g->set_y_legend('', 1, '#736AFF');
$g->y_label_steps(4);
$g->set_y_label_style(8, '#333333', $grpXLabelType, -1);
$g->set_tool_tip((count($grpSubTitle) ? '#x_title#<br>' : '#x_label#<br>') . '#val#');
}
}
}
echo $g->render();
flush();
}
}
}
示例4: 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();
}
示例5: 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 {
$links[] = "./statsCompte.php?cat_id={$val}";
}
}
$pie->pie_slice_colours($color);
$oSmarty->assign("DEBUG", $debug);
$pie->pie_values($data, $label, $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]):
//
$pie->set_tool_tip('#val#%');
$pie->set_width(650);
$pie->set_height(400);
$pie->title('Résumé sur l\'année', '{font-size:18px; color: #d01f3c}');
$pie->set_output_type('js');
$ofc2 = $pie->render();
/*************************************/
$oSmarty->assign("OFC", $ofc);
$oSmarty->assign("OFC2", $ofc2);
$oSmarty->assign("OFC3", $ofc3);
示例6: 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 );
//$g->bar_sketch( 50, 6, '#99FF00', '#7030A0', '% Complete', 10 );
// add the bar object to the graph
示例7: LEFT
case 'os':
$sql = "SELECT LEFT(bots_t.os_version_bot, 3) val, count(loads_t.upId) num FROM bots_t, loads_t \n\t\t\t\tWHERE bots_t.id_bot = loads_t.fk_bot_id AND loads_t.fk_task_id = '{$tid}' AND loads_t.upStatus = '{$status}'\n\t\t\t\tGROUP BY val";
break;
case 'country':
$sql = "SELECT country_t.name_country val, count(loads_t.upId) num FROM loads_t, bots_t, city_t, country_t \n\t\t\t\tWHERE bots_t.id_bot = loads_t.fk_bot_id AND bots_t.fk_city_bot = city_t.id_city AND city_t.fk_country_city =\n\t\t\t\tcountry_t.id_country AND loads_t.fk_task_id = '{$tid}' AND loads_t.upStatus='{$status}' \n\t\t\t\tGROUP BY country_t.id_country ORDER BY num DESC LIMIT 0, " . $db->config('stat_country_num');
break;
}
$res = $db->query($sql);
if ($db->affected_rows > 0) {
while ($mres = $res->fetch_array()) {
$data[] = $mres['num'];
if ($_GET['by'] == 'os') {
$legend[] = get_os($mres['val']);
} else {
$legend[] = CountryCode($mres['val']);
}
}
}
if (!count($data)) {
$data[] = 0;
$legend[] = 'None';
}
$title = $_GET['status'] == 'good' ? 'Good' : 'Fail';
require_once ROOT_PATH . '/plugins/ofc/php-ofc-library/open-flash-chart.php';
$g = new graph();
$g->pie(60, '#505050', '{font-size: 12px; color: #404040;');
$g->pie_values($data, $legend);
$g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810'));
$g->set_tool_tip('#x_label# - #val#');
$g->title($title, '{font-size:18px; color: #d01f3c}');
echo $g->render();
示例8: 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();
}
示例9: 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);
}
示例10: 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();
示例11: 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();*/
}
示例12: 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 ();
?>