当前位置: 首页>>代码示例>>PHP>>正文


PHP graph::line方法代码示例

本文整理汇总了PHP中graph::line方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::line方法的具体用法?PHP graph::line怎么用?PHP graph::line使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在graph的用法示例。


在下文中一共展示了graph::line方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
开发者ID:Nerus87,项目名称:PsychoStats,代码行数:63,代码来源:player.php

示例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);
}
开发者ID:dani0010,项目名称:uncovery_me,代码行数:65,代码来源:donation.php

示例3: graph

    if ($value != 0) {
        $tmp["{$key}"] = $value;
    }
}
$cat_fils_annee = $tmp;
$debug = $cat_fils_annee;
include_once 'ofc-library/open-flash-chart.php';
/************************* Graph sur mois de chaque sous-catégorie *************/
$g = new graph();
// Spoon sales, March 2007
$g->title($cat_name, '{font-size: 26px;}');
foreach ($cat_fils_mois as $key => $value) {
    $g->set_data($value);
    $id = $oCat->getId($key);
    $color = $oCat->getColor($id);
    $g->line(2, "{$color}", $key, 10);
}
//$g->set_data( $cat_fils_mois['Alimentation'] );
//$g->set_data( $cat_fils_mois['Logement'] );
//$g->line( 2, '0x9933CC', 'Alimentation', 10 );
//$g->line( 2, '0x990000', 'Logement', 10 );
// label each point with its value
$g->set_x_labels(array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'));
// set the Y max
$g->set_y_max($cat_fils_mois_max);
// label every 20 (0,20,40,60)
#$g->y_label_steps( 10 );
$g->set_width(650);
$g->set_height(400);
$g->set_output_type('js');
$ofc = $g->render();
开发者ID:relisher,项目名称:logiciel_de_compte,代码行数:31,代码来源:statsCompte.php

示例4: return_ofc_24

function return_ofc_24()
{
    global $cms, $ps;
    $styles =& $cms->theme->styles;
    $hours = array();
    $labels = array();
    $data = array();
    $data_avg = array();
    $conns = array();
    $conns_avg = array();
    $sum = 0;
    $avg = 0;
    $maxlimit = 100;
    $maxlimit2 = 100;
    $minlimit = 0;
    $max = 24;
    list($newest) = $ps->db->fetch_list("SELECT hour FROM {$ps->t_map_hourly} ORDER BY statdate DESC,hour DESC LIMIT 1");
    if ($newest === null) {
        $newest = date("H");
    }
    // build a list of hours in the proper order
    for ($h = $newest; count($hours) < 24; $h--) {
        if ($h < 0) {
            $h = 23;
        }
        $hours[sprintf('%02d:00', $h)] = 'null';
    }
    $hours = array_reverse($hours);
    // get the last 24 hours of data
    $ps->db->query("SELECT statdate,hour,SUM(kills),SUM(connections) " . "FROM {$ps->t_map_hourly} " . "GROUP BY statdate,hour " . "ORDER BY statdate DESC,hour DESC LIMIT {$max}");
    // build our data and labels
    $data = $hours;
    $conns = $hours;
    $maxdata = 0;
    $maxconn = 0;
    while (list($statdate, $hour, $kills, $connections) = $ps->db->fetch_row(0)) {
        $hh = sprintf('%02d:00', $hour);
        $sum += $kills;
        $data[$hh] = $kills;
        $conns[$hh] = $connections;
        $maxdata = max($maxdata, $kills);
        $maxconn = max($maxconn, $connections);
    }
    $labels = array_keys($hours);
    #	print_r($hours);
    #	print_r($data);
    #	print_r($conns);
    #	print_r($labels);
    if ($data) {
        $avg = $sum / count($data);
        $data_avg = array_pad(array(), count($data), $avg);
        #		$maxlimit  = ceil(ceil($maxdata / 100) * 100);
    }
    if ($conns) {
        $avg = $sum / count($conns);
        $conns_avg = array_pad(array(), count($conns), $avg);
        #		$maxlimit2 = ceil(ceil($maxconn / 100) * 100);
    }
    include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
    $g = new graph();
    $g->bg_colour = $styles->val('flash.last24.bgcolor', 'flash.bgcolor');
    $g->title($styles->val('flash.last24.title', $cms->trans('Last 24 Hours'), true), '{' . $styles->val('flash.last24.title.style', 'font-size: 16px', true) . '}');
    $g->set_data($data_avg);
    $g->set_data($data);
    //	$g->set_data($conns_avg);
    $g->set_data($conns);
    $g->attach_to_y_right_axis(3);
    $lines = $styles->attr('flash.last24.lines.line');
    $g->line(coalesce($lines[0]['width'], 1), coalesce($lines[0]['color'], '#9999ee'), coalesce($lines[0]['key'], $cms->trans('Average Kills')), coalesce($lines[0]['key_size'], $styles->val('flash.last24.lines.key_size'), 9));
    $g->line_dot(coalesce($lines[1]['width'], 2), coalesce($lines[1]['dot_size'], 5), coalesce($lines[1]['color'], '#5555ff'), coalesce($lines[1]['key'], $cms->trans('Kills')), coalesce($lines[1]['key_size'], $styles->val('flash.last24.lines.key_size'), 9));
    $g->line_dot(coalesce($lines[2]['width'], 1), coalesce($lines[2]['dot_size'], 3), coalesce($lines[2]['color'], '#000000'), coalesce($lines[2]['key'], $cms->trans('Connections')), coalesce($lines[2]['key_size'], $styles->val('flash.last24.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, '#000000', 0, 3, '#cccccc');
    //	$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.last24.bg_inner1', 'flash.bg_inner1'), '#E3F0FD'), coalesce($styles->val('flash.last24.bg_inner2', 'flash.bg_inner2'), '#CBD7E6'), coalesce($styles->val('flash.last24.bg_inner_angle', 'flash.bg_inner_angle'), 90));
    $g->x_axis_colour('#eeeeee', '#eeeeee');
    $g->y_axis_colour('#5555ff', '#eeeeee');
    $g->y_right_axis_colour('#000000', '#eeeeee');
    //	$g->set_x_offset( false );
    // set the Y max
    $g->set_y_max($maxdata);
    $g->set_y_min(0);
    $g->set_y_right_max($maxconn);
    $g->set_y_right_min(0);
    /*
    	$g->set_y_max($maxlimit);
    	$g->set_y_min($minlimit);
    	$g->set_y_right_min($minlimit);
    	$g->set_y_right_max($maxlimit2);
    */
    $g->set_y_legend(coalesce($lines[1]['key'], $cms->trans('Kills')), 12, coalesce($lines[1]['color'], '#5555ff'));
    $g->set_y_right_legend(coalesce($lines[2]['key'], $cms->trans('Connections')), 12, coalesce($lines[2]['color'], '#000000'));
    //	$g->y_label_steps();
    $g->set_tool_tip($styles->val('flash.last24.tooltip', '#key#<br>#val# (#x_label#)', true));
    // label every 20 (0,20,40,60)
//.........这里部分代码省略.........
开发者ID:Nerus87,项目名称:PsychoStats,代码行数:101,代码来源:overview.php


注:本文中的graph::line方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。