本文整理汇总了PHP中graph::set_y_min方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::set_y_min方法的具体用法?PHP graph::set_y_min怎么用?PHP graph::set_y_min使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::set_y_min方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: return_ofc_data
function return_ofc_data($styles)
{
global $cms, $ps;
$ofc = $cms->input['ofc'];
$data = array();
$data_avg = array();
$avg = 0;
$interval = 1000;
$maxlimit = 1000;
$minlimit = 0;
$max = 21;
$field = $ofc == 'skill' ? 'dayskill' : $ofc;
if (!in_array($field, array('skill', 'kills', 'onlinetime'))) {
$field = 'dayskill';
}
$plrid = $cms->input['id'];
$ps->db->query("SELECT statdate,{$field} FROM {$ps->t_plr_data} WHERE plrid=" . $ps->db->escape($plrid, true) . " ORDER BY statdate DESC LIMIT {$max}");
$i = 1;
while (list($statdate, $skill) = $ps->db->fetch_row(0)) {
$skill = round($skill);
$sum += $skill;
$data[] = $skill;
$labels[] = $statdate;
}
if ($data) {
$data = array_reverse($data);
$labels = array_reverse($labels);
$avg = $sum / count($data);
$data_avg[] = $avg;
$data_avg = array_pad($data_avg, count($data) - 1, 'null');
// yes, 'null' is a string
$data_avg[] = $avg;
$minlimit = floor(min($data) / $interval) * $interval;
$maxlimit = ceil(max($data) / $interval) * $interval;
}
include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
$g = new graph();
$g->bg_colour = $styles->val('flash.plrskill.bgcolor', 'flash.bgcolor');
$g->title($styles->val('flash.plrskill.title'), '{' . $styles->val('flash.plrskill.title.style', 'font-size: 12px', true) . '}');
$g->set_data($data_avg);
$g->set_data($data);
$lines = $styles->attr('flash.plrskill.lines.line');
$g->line(coalesce($lines[0]['width'], 1), coalesce($lines[0]['color'], '#9999ee'), coalesce($lines[0]['key'], $cms->trans('Average')), coalesce($lines[0]['key_size'], $styles->val('flash.plrskill.lines.key_size'), 9));
$g->line(coalesce($lines[1]['width'], 1), coalesce($lines[1]['color'], '#9999ee'), coalesce($lines[1]['key'], $cms->trans('Skill')), coalesce($lines[1]['key_size'], $styles->val('flash.plrskill.lines.key_size'), 9));
// label each point with its value
$g->set_x_labels($labels);
// $g->set_x_axis_steps(count($labels) / 3 + 1);
// $g->set_x_tick_size(1);
// $g->set_x_label_style( 10, '0x000000', 0, 2 );
// $g->set_x_label_style('none');
$g->set_x_label_style(8, '#000000', 2);
$g->set_inner_background(coalesce($styles->val('flash.plrskill.bg_inner1', 'flash.bg_inner1'), '#E3F0FD'), coalesce($styles->val('flash.plrskill.bg_inner2', 'flash.bg_inner2'), '#CBD7E6'), coalesce($styles->val('flash.plrskill.bg_inner_angle', 'flash.bg_inner_angle'), 90));
$g->x_axis_colour('#eeeeee', '#eeeeee');
$g->y_axis_colour('#eeeeee', '#eeeeee');
// $g->set_x_offset( false );
// set the Y max
$g->set_y_max($maxlimit);
$g->set_y_min($minlimit);
// label every 20 (0,20,40,60)
// $g->x_label_steps( 2 );
// display the data
print $g->render();
}
示例2: umc_donation_java_chart
function umc_donation_java_chart()
{
global $UMC_SETTING;
$sql_chart = "SELECT SUM(amount) as monthly, year(date) as date_year, month(date) as date_month FROM minecraft_srvr.`donations` GROUP BY YEAR(date), MONTH(date);";
$D = umc_mysql_fetch_all($sql_chart);
$lastdate = "2010-11";
$ydata = array();
$legend = array();
$minval = $maxval = 0;
$sum = 0;
foreach ($D as $row) {
$month = sprintf("%02d", $row['date_month']);
$date = $row['date_year'] . '-' . $month;
$datetime1 = new DateTime("{$lastdate}-01");
$datetime2 = new DateTime("{$date}-01");
$interval = $datetime1->diff($datetime2);
$int = $interval->format('%m');
$int--;
for ($i = $int; $i > 0; $i--) {
// echo "$i $int - ";
$e_date = date("Y-m", mktime(0, 0, 0, $row['date_month'] - $i, 01, $row['date_year']));
// $e_month = $row['date_month'] - $i;
// $e_date = $row['date_year'] . '-' . $e_month;
$sum = $sum - 135;
$ydata[] = $sum;
//echo $e_date . ": " . $sum . "<br>";
$legend[] = $e_date . "-01";
$maxval = max($sum, $maxval);
$minval = min($sum, $minval);
}
$sum = $sum + $row['monthly'] - 135;
//echo $date . ": " . $sum . "<br>";
$ydata[] = $sum;
$legend[] = $date . "-01";
$lastdate = $date;
$maxval = max($sum, $maxval);
$minval = min($sum, $minval);
}
$outstanding = $sum * -1;
require_once $UMC_SETTING['path']['html'] . '/admin/flash/open-flash-chart.php';
$g = new graph();
//$g->title("Donation Stats", '{font-size: 15px; color: #000000}');
$g->bg_colour = '#FFFFFF';
// Some data (line 1):
$g->set_data($ydata);
$legend1 = "Cost vs. donations balance in USD";
$g->line(1, '#0000FF', $legend1, 10);
// $g->set_y_legend( $legend1, 12, '#0000FF' );
$g->set_y_max($maxval);
$g->set_y_min($minval);
$g->y_axis_colour('#0000FF', '#DFDFDF');
$g->x_axis_colour('#DFDFDF', '#FFFFFF');
$g->set_x_legend('Uncovery Minecraft Server uptime', 12, '#000000');
// The X Axis labels are the time, 00:00, 01:00, 02:00 etc...
$g->set_x_labels($legend);
$g->set_x_label_style(8, '#000000', 1, 1, '#DFDFDF');
// lines in the background
$g->y_label_steps(10);
$g->set_width('100%');
$g->set_height(300);
$g->set_output_type('js');
$g->set_js_path('/admin/flash/');
$g->set_swf_path('/admin/flash/');
return array('chart' => $g->render(), 'outstanding' => $outstanding);
}
示例3: graph
$g->set_height(400);
$g->set_output_type('js');
$ofc = $g->render();
/****************** bar de la catégorie sur l'année */
$g = new graph();
$g->title("{$cat_name}", '{font-size:20px; color: #bcd6ff; margin:10px;}');
$color = $oCat->getColor($cat_id);
$bar = new bar_glass(55, "{$color}", "{$color}");
$bar->data = $cat_annee;
$g->data_sets[] = $bar;
// label the X axis (10 labels for 10 bars):
$g->set_x_labels(array('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October'));
// colour the chart to make it pretty:
$g->x_axis_colour('#909090', '#D2D2FB');
$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;');
//
示例4: return_ofc_day
function return_ofc_day()
{
global $cms, $ps;
$styles =& $cms->theme->styles;
$days = array();
$labels = array();
$data = array();
$data_avg = array();
$sum = 0;
$avg = 0;
$max = 31;
$maxlimit = 100;
// get the last 31 days of data
$list = $ps->db->fetch_rows(1, "SELECT statdate,SUM(connections) connections " . "FROM {$ps->t_map_data} " . "GROUP BY statdate " . "ORDER BY statdate DESC LIMIT {$max}");
$now = $list ? ymd2time($list[0]['statdate']) : time();
while (count($days) < $max) {
$days[date('Y-m-d', $now)] = 'null';
$labels[] = date('M jS', $now);
$now -= 60 * 60 * 24;
}
$days = array_reverse($days);
$labels = array_reverse($labels);
// build our data and labels
$data = $days;
$maxdata = 0;
foreach ($list as $d) {
if (!array_key_exists($d['statdate'], $days)) {
continue;
}
$sum += $d['connections'];
$data[$d['statdate']] = $d['connections'];
$maxdata = max($maxdata, $d['connections']);
}
if ($data) {
$avg = $sum / count($data);
$data_avg[] = $avg;
$data_avg = array_pad($data_avg, count($data), 'null');
$data_avg[] = $avg;
# $data_avg = array_pad(array(), count($data), $avg);
$maxlimit = ceil(ceil($maxdata / 100) * 100);
}
include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
$g = new graph();
$g->bg_colour = $styles->val('flash.conn.bgcolor', 'flash.bgcolor');
$g->title($styles->val('flash.conn.title', $cms->trans('Daily Connections'), true), '{' . $styles->val('flash.conn.title.style', 'font-size: 16px', true) . '}');
# $g->set_data($data_avg);
# $g->line(1, '#9999ee', 'Average Connections', 9);
# $g->set_data($data);
## $g->line_hollow(1, 3, '#5555ff', 'Connections', 9);
# $g->bar(75, '#5555ff', 'Connections', 9);
$avg_line = new line($styles->val('flash.conn.line.width'), $styles->val('flash.conn.line.color'));
$avg_line->key($styles->val('flast.conn.line.key', $cms->trans('Average Connections'), true), $styles->val('flash.conn.line.size', 9, true));
$avg_line->data = $data_avg;
$conn_bar = new bar_3d($styles->val('flash.conn.bar3d.opacity', 75, true), $styles->val('flash.conn.bar3d.color1', '#5555ff', true), $styles->val('flash.conn.bar3d.color2', '#3333DD', true));
$conn_bar->key($styles->val('flash.conn.bar3d.key', $cms->trans('Connections'), true), $styles->val('flash.conn.bar3d.size', 9, true));
$conn_bar->data = $data;
/*
$keys = array_keys($data);
for ($i=0; $i<count($data); $i++) {
$conn_bar->add_data_tip($data[$keys[$i]],
$cms->trans("Connections: %d", $data[$keys[$i]]) . "<br>" .
$cms->trans("Average: %d", $data_avg[0])
);
}
/**/
$g->set_tool_tip(sprintf($styles->val('flash.conn.tooltip', '#x_label#<br>#key#: #val# (' . $cms->trans('Avg') . ': %d)', true), round($data_avg[0])));
$g->data_sets[] = $avg_line;
$g->data_sets[] = $conn_bar;
$g->set_x_axis_3d(6);
// label each point with its value
$g->set_x_labels($labels);
// $g->set_x_axis_steps(count($labels) / 3 + 1);
// $g->set_x_tick_size(1);
$g->set_x_label_style(10, '#000000', 0, 3, '#cccccc');
// $g->set_x_label_style('none');
# $g->set_x_label_style( 8, '#000000', 2 );
$g->set_inner_background(coalesce($styles->val('flash.conn.bg_inner1', 'flash.bg_inner1'), '#E3F0FD'), coalesce($styles->val('flash.conn.bg_inner2', 'flash.bg_inner2'), '#CBD7E6'), coalesce($styles->val('flash.conn.bg_inner_angle', 'flash.bg_inner_angle'), 90));
$g->x_axis_colour('#909090', '#ADB5C7');
// $g->x_axis_colour('#eeeeee', '#eeeeee');
$g->y_axis_colour('#5555ff', '#eeeeee');
// $g->set_x_offset( false );
// set the Y max
$g->set_y_min(0);
$g->set_y_max($maxlimit);
$g->set_y_legend($styles->val('flash.conn.bar3d.key', $cms->trans('Connections')), 12, $styles->val('flash.conn.bar3d.color1', '#5555ff', true));
print $g->render();
}
示例5: min
// add the bar object to the graph
//
$g->data_sets[] = $bar;
$g->set_x_max(count($labels));
$g->set_x_min(count($labels));
$g->set_x_label_style( 11, '#A0A0A0', 2 );
$g->set_y_label_style( 11, '#A0A0A0' );
$g->x_axis_colour( '#A0A0A0', '#FFFFFF' );
//$g->set_x_legend( 'Week 1', 12, '#A0A0A0' );
$g->y_axis_colour( '#A0A0A0', '#FFFFFF' );
$g->set_y_min( min($data) );
$g->set_y_max( max($data) );
$g->y_label_steps( 2 );
}
?>
<html>
<head>
<title><?=$title?></title>
<link rel="stylesheet" rev="stylesheet" href="css/chart.css" type="text/css" media="screen"/>
</head>
<body>
<ul>
<li class="chart_bar">
<a href="<?=$resubmit. "&type=bar"?>"><span>Barra</span></a>
</li>
示例6: microtime
}
}
srand ( ( double ) microtime () * 1000000 );
$bar_1 = new bar_glass ( 55, '#5E83BF', '#424581' );
$bar_1->key ( titulo_selecionado ( $param ), 10 );
for($i = 0; $i < $total; $i ++)
$bar_1->data [] = resultadorelatorio ( $vetor_url [$i], $param );
$g = new graph ( );
$g->data_sets [] = $bar_1;
$g->set_x_labels ( $nome_colecao );
$g->x_axis_colour ( '#FFFFFF', '#D2D2FB' );
$g->y_axis_colour ( '#FFFFFF', '#D2D2FB' );
$g->bg_colour = '#FFFFFF';
$g->set_x_label_style ( 0, '#FFFFFF', 0, 0 );
$g->set_y_min ( $menorvalor );
$g->set_y_max ( $maiorvalor );
$g->y_label_steps ( 5 );
echo $g->render ();
?>
示例7: substr
$count = 0;
while ($row = mysql_fetch_array($result)) {
//print_r($row);
$added = false;
if ($count % $num_obs == 0) {
$data[] = $row['amount'];
$dates[] = substr($row['last_update'], 0, 10);
$added = true;
}
$count++;
if ($count == $num_rows && !$added) {
$data[] = $row['amount'];
$dates[] = substr($row['last_update'], 0, 10);
$added = true;
}
}
$min = 0.85 * min($data);
$max = 1.15 * max($data);
// set the data
$g->set_data($data);
// new line_dot object
$g->line_dot(3, 5, '#666666', "Total Value");
// x-axis
$g->set_x_labels(dates);
$g->set_x_label_style(10, '#0000FF', 2);
// y-axis
$g->set_y_max($max);
$g->set_y_min($min);
$g->y_label_steps(10);
$g->set_y_legend('Amount ($)', 12, '#336666');
echo $g->render;
示例8: microtime
}
srand ( ( double ) microtime () * 1000000 );
$bar_1 = new bar_glass ( 55, '#5E83BF', '#424581' );
$bar_1->key ( titulo_selecionado_fornecedor ( $param ), 10 );
for($i = 0; $i < $total; $i ++)
$bar_1->data [] = ( double ) resultadorelatorio_fornecedor ( $vetor_url [$i], $param );
$g = new graph ( );
//$g->data_sets[] = $bar;
$g->data_sets [] = $bar_1;
$g->set_x_labels ( $nome_fornecedor );
$g->x_axis_colour ( '#FFFFFF', '#D2D2FB' );
$g->y_axis_colour ( '#FFFFFF', '#D2D2FB' );
$g->bg_colour = '#FFFFFF';
$g->set_x_label_style ( 0, '#FFFFFF', 0, 0 );
$g->set_y_min ( ( double ) $menorvalor );
$g->set_y_max ( ( double ) $maiorvalor );
$g->y_label_steps ( 5 );
echo $g->render ();
?>