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


PHP graph::set_x_labels方法代码示例

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


在下文中一共展示了graph::set_x_labels方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: grafico

 function grafico($anio = '')
 {
     $this->load->library('Graph');
     if (empty($anio)) {
         return;
     }
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $mSQL = "SELECT a.vd, LEFT(b.nombre, 8)as nombre2,                                            \n\t\t sum(a.totalg*IF(a.tipo_doc='D', -1, 1)) AS grantotal,                              \n\t\t sum(a.totalg*(a.referen IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS contado,        \n\t\t sum(a.totalg*(a.referen NOT IN ('E', 'M'))*IF(a.tipo_doc='D', -1, 1)) AS credito     \n\t\t FROM sfac AS a \n\t\t JOIN vend AS b  ON a.vd=b.vendedor                                                                   \n\t\t WHERE a.tipo_doc<>'X' AND a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}'                  \n\t\t GROUP BY a.vd ORDER BY a.vd,grantotal DESC LIMIT 10";
     $maxval = 0;
     $query = $this->db->query($mSQL);
     $data_1 = $data_2 = $data_3 = $vendedor = array();
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $nombre[] = $row->nombre2;
         $vendedor[] = $row->vd;
         $data_1[] = $row->contado;
         $data_2[] = $row->credito;
         $data_3[] = $row->grantotal;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar(75, '#0053A4');
     $bar_2 = new bar(75, '#9933CC');
     $bar_3 = new bar(75, '#639F45');
     $bar_1->key('Contado', 10);
     $bar_2->key('Credito', 10);
     $bar_3->key('Total', 10);
     for ($i = 0; $i < count($data_1); $i++) {
         $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
         $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
         $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.')));
         $bar_1->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
         $bar_2->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
         $bar_3->links[] = site_url("/ventas/vendedoresmensuales/index/{$anio}/" . $vendedor[$i]);
     }
     $g = new graph();
     $g->title('Los 10 vendedores con los indice de ventas m&aacute;s altos en el a&ntilde;o' . $anio, '{font-size: 22px; color:##00264A}');
     $g->set_is_decimal_separator_comma(1);
     $g->data_sets[] = $bar_1;
     $g->data_sets[] = $bar_2;
     $g->data_sets[] = $bar_3;
     $g->set_x_labels($nombre);
     $g->set_x_label_style(10, '#000000', 3, 1);
     $g->set_x_axis_steps(10);
     $g->set_x_legend('Vendedores', 14, '#004381');
     $g->bg_colour = '#FFFFFF';
     $g->set_tool_tip('#key#<br>Vendedor: #x_label# <br>Monto: #tip#');
     $g->set_y_max(ceil($maxval / $om));
     $g->y_label_steps(5);
     $g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:57,代码来源:anuales.php

示例2: mkCacheData

 function mkCacheData($date_from, $date_to, $product_id)
 {
     $conditions = array();
     $info = $this->dbstuff->GetRow("SELECT * FROM " . $this->table_prefix . "products WHERE id='" . $product_id . "'");
     if (!empty($info)) {
         $_GET['pn'] = $info['name'];
     }
     $mdt = date("Ymd") . "_" . substr(md5($_GET['pn'] . $_GET['ds'] . $_GET['de']), 0, 6);
     $file_item = $mdt;
     $file_path = DATA_PATH . "tmp/" . $file_item . $this->cache_ext;
     if (!file_exists($file_path)) {
         // use the chart class to build the chart:
         include_once LIB_PATH . 'ofc/chart.php';
         $g = new graph();
         $result = $this->dbstuff->GetArray("SELECT DATE_FORMAT(FROM_UNIXTIME(created),'%m') as mn,avg(max_price) AS avmax,avg(min_price) AS avmin FROM " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to} group by mn ORDER BY created ASC");
         if (!empty($result)) {
             foreach ($result as $val) {
                 $data[] = floor(($val['avmax'] + $val['avmin']) / 2);
             }
             $title = L("stat_charts", "tpl") . $_GET['ds'] . L("arrive_to", "tpl") . $_GET['de'];
         } elseif ($info['name']) {
             $title = $info['name'];
         } else {
             $title = L("data_not_exists") . df();
         }
         $g->title($title, '{font-size: 24px;color: #0000FF}');
         $g->set_data($data);
         $g->line_hollow(2, 4, '0x80a033', $_GET['pn'], 10);
         // label each point with its value
         //$g->set_x_labels( explode(",", L("months", "tpl")) );
         $x_result = $this->dbstuff->GetArray("select CONCAT(FROM_UNIXTIME(created, '%Y'),'/',FROM_UNIXTIME(created, '%m')) as m from " . $this->table_prefix . "quotes WHERE created BETWEEN {$date_from} AND {$date_to} group by DATE_FORMAT(FROM_UNIXTIME(created),'%m') ORDER BY created ASC");
         foreach ($x_result as $val) {
             $x_tmp[] = $val['m'];
         }
         $g->set_x_labels($x_tmp);
         $label_y = $this->dbstuff->GetRow("select max(max_price) as price_max,min(min_price) as price_min from " . $this->table_prefix . "quotes WHERE product_id=" . $product_id . " AND created BETWEEN {$date_from} AND {$date_to}");
         $y_max = !empty($label_y['price_max']) ? $label_y['price_max'] : 100;
         // set the Y max
         $this->max_price = $label_y['price_max'];
         $this->min_price = $label_y['price_min'];
         $g->set_y_max($label_y['price_max']);
         // label every 20 (0,20,40,60)
         $g->y_label_steps(6);
         // display the data
         file_put_contents($file_path, $g->render());
     }
     $this->cache_datafile = $file_item . $this->cache_ext;
 }
开发者ID:reboxhost,项目名称:phpb2b,代码行数:48,代码来源:quote.php

示例3: grafico

 function grafico($titulo)
 {
     $this->load->library('Graph');
     $mSQL_1 = "SELECT cod_cli,nombre,   \r\n\t\t\tsum(totalg*IF(tipo_doc='D', -1, 1)) AS grantotal, \r\n\t\t\tsum(totalg*(referen IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS contado,\r\n\t\t\tsum(totalg*(referen NOT IN ('E', 'M'))*IF(tipo_doc='D', -1, 1)) AS credito \r\n\t\t\tFROM sfac\r\n\t\t\tWHERE tipo_doc<>'X' AND fecha>='20070101' AND fecha<='20071231' \r\n\t\t\tGROUP BY cod_cli ORDER BY grantotal DESC LIMIT 10";
     // generate some random data
     srand((double) microtime() * 1000000);
     $bar_1 = new bar_fade(50, '#209B2C');
     $bar_1->key('Contado', 10);
     $bar_2 = new bar_fade(50, '#9933CC');
     $bar_2->key('Credito', 10);
     $bar_3 = new bar_fade(50, '#639F45');
     $bar_3->key('Total', 10);
     $maxval = 0;
     $label = $tips = array();
     $query = $this->db->query($mSQL_1);
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $bar_1->data[] = $row->contado;
         $bar_2->data[] = $row->credito;
         $bar_3->data[] = $row->grantotal;
         //$bar_1->tips = $data_tips_3;
         $tips[] = $row->nombre;
         $label[] = $row->cod_cli;
     }
     $g = new graph();
     $g->title($titulo, '{font-size: 26px;}');
     $g->data_sets[] = $bar_1;
     $g->data_sets[] = $bar_2;
     $g->data_sets[] = $bar_3;
     $g->set_x_labels($label);
     $g->set_x_label_style(10, '#9933CC', 2, 1);
     $g->set_x_axis_steps(10);
     $g->bg_colour = '#FFFFFF';
     $g->set_tool_tip('#key#<br>Codigo de Clinte: #x_label# <br>Monto: #tip#');
     $g->tips = $tips;
     $g->set_y_max($maxval);
     $g->y_label_steps(3);
     $g->set_y_legend('Open Flash Chart', 12, '0x736AFF');
     echo utf8_encode($g->render());
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:42,代码来源:demo.php

示例4: grafico

 function grafico($anio = '', $codigo = '')
 {
     $this->load->library('Graph');
     if (empty($anio) or empty($codigo)) {
         return;
     }
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $mSQL = "SELECT MONTHNAME(fecha)AS mes,codigo,nombre,sueldoa,sueldo FROM ausu\n    WHERE fecha>='{$fechai}' AND fecha<='{$fechaf}'AND codigo='{$codigo}'\n    ORDER BY fecha";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->sueldoa > $maxval) {
             $maxval = $row->sueldoa;
         }
         $nombre = $row->nombre;
         $meses[] = $row->mes;
         $data_1[] = $row->sueldoa;
         $data_2[] = $row->sueldo;
         //$data_3[]=$row->sueldoa;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar(75, '#0053A4');
     $bar_2 = new bar(75, '#9933CC');
     //$bar_3 = new bar(75, '#639F45');
     $bar_1->key('Sueldo Anterior', 10);
     $bar_2->key('Sueldo con Aumento', 10);
     //$bar_3->key('Total'  ,10);
     for ($i = 0; $i < count($data_1); $i++) {
         $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
         $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
         //$bar_3->add_data_tip($data_3[$i]/$om, graph::esc( number_format($data_3[$i],2,',','.')));
     }
     $g = new graph();
     $g->title('Aumento de ' . $nombre . ' en el a&ntilde;o ' . $anio, '{font-size: 20px; color:##00264A}');
     $g->set_is_decimal_separator_comma(1);
     $g->data_sets[] = $bar_1;
     $g->data_sets[] = $bar_2;
     //$g->data_sets[] = $bar_3;
     $g->set_x_labels($meses);
     $g->set_x_label_style(10, '#000000', 3, 1);
     $g->set_x_axis_steps(10);
     $g->set_x_legend('Meses', 16, '#004381');
     $g->bg_colour = '#FFFFFF';
     $g->set_tool_tip('#key#<br>Mes: #x_label# <br>Monto: #tip#');
     $g->set_y_max(ceil($maxval / $om));
     $g->y_label_steps(5);
     $g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:54,代码来源:aumentoempleados.php

示例5: array

$res_max = mysql_query($sql_max);
$num_max = mysql_num_rows($res_max);
$fet_max = mysql_fetch_array($res_max);
//$max_y=($num_data * 5);
$max_y = $fet_max['tkts'] + 50;
//$bar = new bar_outline( 50, '#3399cc', '#3399ff' );
$bar = new bar_outline($max_y, '#3399cc', '#3399ff');
$bar->key('Tickets', 10);
$data = array();
$lbl = array();
if ($num_data > 0) {
    do {
        $bar->data[] = intval($fet_data['tkts']);
        $xlabels[] = mysql_escape_string($fet_data['tktcategoryname']);
    } while ($fet_data = mysql_fetch_array($res_data));
    $g = new graph();
    $g->data_sets[] = $bar;
    $g->bg_colour = '#ffffff';
    $g->set_x_labels($xlabels);
    $g->set_x_label_style(10, '#9933CC', 2, 1);
    //
    // and tick every second value:
    //
    $g->set_x_axis_steps(1);
    //
    $g->set_y_max($max_y);
    $g->y_label_steps(4);
    $g->set_y_legend('No. of Tickets', 12, '#736AFF');
    echo $g->render();
}
//close if thre is data
开发者ID:CustomerFeedback,项目名称:System-Files-Installable,代码行数:31,代码来源:chart_graph_1_global.php

示例6: CasesByProcess

 function CasesByProcess()
 {
     $dataSet = $this->getCasesByProcess();
     $data = $dataSet['data'];
     //$series2 = $dataSet['series2'];
     $g = new graph();
     $g->title(' Cases by Process ', '{font-size: 14px;}');
     $bar_red = new bar_3d(50, '#3334AD');
     $bar_red->key('cases', 10);
     $bar_red->data = $data;
     $g->data_sets[] = $bar_red;
     $g->set_x_axis_3d(12);
     $g->x_axis_colour('#909090', '#ADB5C7');
     $g->y_axis_colour('#909090', '#ADB5C7');
     $g->set_x_labels($dataSet['label']);
     $g->set_y_max($dataSet['max']);
     $g->y_label_steps(6);
     echo $g->render();
 }
开发者ID:emildev35,项目名称:processmaker,代码行数:19,代码来源:class.openFlash.php

示例7: graph

 function Chart3DBAR($LimiteMaximo = 100, $titulo = "", $titulo2 = "")
 {
     $data = $this->mValues;
     $label = $this->mLabels;
     $g = new graph();
     $g->title($this->mTitle, '{font-size:16px; color: #FFFFFF; margin: 5px; background-color: #505050; padding:5px; padding-left: 20px; padding-right: 20px;}');
     //$g->set_data( $data_1 );
     //$g->bar_3D( 75, '#D54C78', '2006', 10 );
     //$g->set_data( $data_2 );
     //$g->bar_3D( 75, '#3334AD', '2007', 10 );
     //Crea el Bar Blue
     $bar_blue = new bar_3d(75, '#3334AD');
     $bar_blue->key($titulo, 10);
     $bar_blue->data = $this->mValues;
     $g->data_sets[] = $bar_blue;
     if (is_array($this->mValues2)) {
         $bar_blue2 = new bar_3d(75, '#ff0000');
         $bar_blue2->key($titulo2, 10);
         $bar_blue2->data = $this->mValues2;
         $g->data_sets[] = $bar_blue2;
     }
     $g->set_x_axis_3d(12);
     $g->x_axis_colour('#909090', '#ADB5C7');
     $g->y_axis_colour('#909090', '#ADB5C7');
     $g->set_x_labels($this->mLabels);
     $g->set_y_max($LimiteMaximo);
     $g->y_label_steps(5);
     //$g->set_y_legend( 'Open Flash Chart', 12, '#736AFF' );
     $x = $g->render();
     return $this->setWriteFile($x);
 }
开发者ID:Cywaithaka,项目名称:S.A.F.E.-Open-Source-Microfinance-Suite,代码行数:31,代码来源:core.html.inc.php

示例8: 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

示例9: gdiarias

 function gdiarias($anio = '', $proveed = '', $mes = '')
 {
     $this->load->library('Graph');
     if (empty($mes) or empty($anio) or empty($proveed)) {
         return;
     }
     $proveed = radecode($proveed);
     $fechai = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, '0', STR_PAD_LEFT) . '31';
     $dbfechai = $this->db->escape($fechai);
     $dbfechaf = $this->db->escape($fechaf);
     $dbproveed = $this->db->escape($proveed);
     $mSQL = "SELECT  LEFT(nombre,10)as nombre,proveed,DAYOFMONTH(fecha) AS dia ,\n\t\tSUM(montonet*IF(tipo_doc='NC', -1, 1)) AS grantotal,\n\t\tSUM(credito*IF( tipo_doc='NC', -1, 1)) AS credito,\n\t\tSUM(inicial*IF( tipo_doc='NC', -1, 1)) AS contado\n\t\tFROM scst\n\t\tWHERE tipo_doc<>'NE' AND fecha>={$dbfechai} AND fecha<={$dbfechaf} AND proveed={$dbproveed}\n\t\t\tAND actuali >= fecha\n\t\tGROUP BY fecha ORDER BY fecha,grantotal DESC LIMIT 31";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $fecha[] = $row->dia;
         $nombre = str_replace('&', '', $row->nombre);
         //$data_1[]=$row->contado;
         //$data_2[]=$row->credito;
         $data_3[] = $row->grantotal;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     //$bar_1 = new bar(75, '#0053A4');
     //$bar_2 = new bar(75, '#9933CC');
     $bar_3 = new bar(75, '#639F45');
     //$bar_1->key('Contado',10);
     //$bar_2->key('Credito',10);
     $bar_3->key('Total Bs.', 10);
     for ($i = 0; $i < count($data_3); $i++) {
         //$bar_1->add_data_tip($data_1[$i]/$om, graph::esc( number_format($data_1[$i],2,',','.')));
         //$bar_2->add_data_tip($data_2[$i]/$om, graph::esc( number_format($data_2[$i],2,',','.')));
         $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.')));
     }
     $g = new graph();
     $g->set_is_decimal_separator_comma(1);
     if ($maxval > 0) {
         $g->title('Compras a ' . $nombre . '  en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:##00264A}');
         //$g->data_sets[] = $bar_1;
         //$g->data_sets[] = $bar_2;
         $g->data_sets[] = $bar_3;
         $g->set_x_labels($fecha);
         $g->set_x_label_style(10, '#000000', 3, 1);
         $g->set_x_axis_steps(10);
         $g->set_x_legend('Dias', 14, '#004381');
         $g->bg_colour = '#FFFFFF';
         $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#');
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         $g->set_y_legend('Compras x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     } else {
         $g->title('No existen compras con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:63,代码来源:proveedores.php

示例10: isset

 /**
  */
 function chart_flash($data, $params)
 {
     if (empty($data)) {
         return;
     }
     include_once YF_PATH . 'libs/yf_open_flash_chart/open-flash-chart.php';
     $width = isset($params['width']) ? $params['width'] : '90%';
     $height = isset($params['height']) ? $params['height'] : '90%';
     $g = new graph();
     $g->js_path = isset($params['js_path']) ? $params['js_path'] : '/js/';
     $g->swf_path = isset($params['swf_path']) ? $params['swf_path'] : '/js/';
     $g->title(' ', '{font-size: 20px;}');
     $g->bg_colour = '#e9e9e9';
     $g->x_axis_colour('#000000', '#c1c1c1');
     $g->y_axis_colour('#000000', '#c1c1c1');
     $g->set_data($data);
     // Find maximal strlen of x axis label
     foreach ((array) $data as $k => $v) {
         $xlabel_len[] = _strlen($k);
     }
     if (max($xlabel_len) > 7) {
         $orientation = 2;
     } else {
         $orientation = 0;
     }
     $g->set_x_labels(array_keys($data));
     $g->set_x_label_style(10, '#000000', $orientation, 2);
     $g->set_y_max(max($data));
     $g->set_y_label_style(10, '#000000', 0, 2);
     $g->set_y_legend('Price', 10, '#000000');
     $g->set_x_legend('Date', 10, '#000000');
     $g->set_tool_tip('#val# EUR on #x_label#');
     $g->line_dot(2, 3, '#0750D9', '', 10);
     // формат значений
     $g->set_num_decimals(0);
     $g->set_y_format('#val#&euro;');
     $g->set_width($width);
     $g->set_height($height);
     $g->set_output_type('js');
     return $g->render();
 }
开发者ID:yfix,项目名称:yf,代码行数:43,代码来源:yf_charts.class.php

示例11: 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

示例12: SUM

 function grafico4($codigoadm, $partida)
 {
     $this->load->library('Graph');
     $mSQL = "SELECT codigopres,a.ordinal, \r\n\t\t\t\t\tSUM(asignacion+aumento-disminucion+traslados) as presupuesto, \r\n\t\t                        SUM(comprometido) comprometido, \r\n\t\t                        SUM(causado) causado, \r\n\t\t                        SUM(pagado) pagado\r\n\t\tFROM ordinal a JOIN ppla b ON a.codigopres=b.codigo\r\n\t\tWHERE b.movimiento='S' AND a.codigoadm='{$codigoadm}' AND codigopres LIKE '{$partida}%'\r\n\t\tGROUP BY codigopres,a.ordinal\r\n\t\tHAVING presupuesto<>0";
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->presupuesto > $maxval) {
             $maxval = $row->presupuesto;
         }
         $codigopres[] = $row->ordinal;
         $data_1[] = $row->presupuesto;
         $data_2[] = $row->comprometido;
         $data_3[] = $row->causado;
         $data_4[] = $row->pagado;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar(75, '#0053A4');
     $bar_2 = new bar(75, '#9933CC');
     $bar_3 = new bar(75, '#639F45');
     $bar_4 = new bar(75, '#C34F33');
     $bar_1->key('Presupuesto', 10);
     $bar_2->key('Comprometido', 10);
     $bar_3->key('Causado', 10);
     $bar_4->key('Pagado', 10);
     for ($i = 0; $i < count($data_1); $i++) {
         $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
         $bar_2->add_data_tip($data_2[$i] / $om, graph::esc(number_format($data_2[$i], 2, ',', '.')));
         $bar_3->add_data_tip($data_3[$i] / $om, graph::esc(number_format($data_3[$i], 2, ',', '.')));
         $bar_4->add_data_tip($data_4[$i] / $om, graph::esc(number_format($data_4[$i], 2, ',', '.')));
     }
     $g = new graph();
     $g->set_is_decimal_separator_comma(1);
     if ($maxval > 0) {
         $g->data_sets[] = $bar_1;
         $g->data_sets[] = $bar_2;
         $g->data_sets[] = $bar_3;
         $g->data_sets[] = $bar_4;
         $g->set_x_labels($codigopres);
         $g->set_x_label_style(10, '#000000', 2, 1);
         $g->set_x_axis_steps(10);
         $g->set_x_legend('Presupuestos', 14, '#004381');
         $g->bg_colour = '#FFFFFF';
         $g->set_tool_tip('#key#<br>Codigo: #x_label# <br>Monto: #tip#');
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         $g->set_y_legend('Presupuesto x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     } else {
         $g->title('No existen Presupuestos', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
开发者ID:enderochoa,项目名称:tortuga,代码行数:56,代码来源:gpresup.php

示例13: projectsCreated

 /**
  * Generates report of projects created
  *
  * @access	public
  * @param	nil
  * @return	void
  */
 function projectsCreated()
 {
     //Load Language File For this
     $this->lang->load('enduser/reports', $this->config->item('language_code'));
     //Load Library File
     $this->load->library('graph');
     // generate some random data
     srand((double) microtime() * 1000000);
     // NOTE: how we are filling 3 arrays full of data,
     //       one for each line on the graph
     $data_1 = array();
     $mon = array();
     for ($i = 0; $i < 6; $i++) {
         $lastmonth = mktime(0, 0, 0, date("m") - $i, date("d"), date("Y"));
         $month = date('n', $lastmonth);
         $year = date('Y', $lastmonth);
         $data_1[] = $this->skills_model->getNumProjectsByMonth($month, $year);
         $mon[] = date('M', $lastmonth);
     }
     $g = new graph();
     $g->title($this->lang->line('Projects added last 6 months'), '{font-size: 20px; color: #999999}');
     // we add 2 sets of data:
     $g->set_data($data_1);
     $g->set_bg_colour('0xFFFFFF');
     // we add the 3 line types and key labels
     $g->line_dot(3, 5, 'FF6633', 'Projects', 12);
     // <-- 3px thick + dots
     $g->set_x_labels($mon);
     $g->set_x_label_style(10, '0x000000', 0, 1);
     $g->set_y_max(50);
     $g->y_label_steps(4);
     echo $g->render();
 }
开发者ID:khanals,项目名称:rbs-ext,代码行数:40,代码来源:reports.php

示例14: date

$max = 0;
for ($i = -4; $i < 1; $i++) {
    $date = date('Y-m-d', strtotime($i . ' days'));
    if ($i == 0) {
        $daysRow[] = t('Today');
    } else {
        $daysRow[] = strftime('%a', strtotime($i . ' days'));
    }
    $total = PageStatistics::getTotalPageViewsForOthers($u, $date);
    $viewsArray[] = $total;
    if ($total > $max) {
        $max = $total;
    }
}
$g = new graph();
$g->set_title('&nbsp;', '{color: #ffffff}');
$g->set_data($viewsArray);
$g->bg_colour = '#ffffff';
$g->set_inner_background('#ffffff', "#cccccc", 90);
// we add the 3 line types and key labels
$g->line_dot(3, 5, '#4C85BB', false, 10);
$g->set_x_labels($daysRow);
$g->set_x_label_style(10, '#ababab', 0, 2);
$g->x_axis_colour('#333333', '#bebebe');
$g->y_axis_colour('#333333', '#bebebe');
$g->set_y_max($max);
$g->num_decimals = 0;
$g->is_fixed_num_decimals_forced = true;
$g->y_label_steps(5);
$g->set_y_legend(t('Views'), 12, '#333333');
echo $g->render();
开发者ID:homer6,项目名称:concrete5-mirror,代码行数:31,代码来源:chart_handler.php

示例15: gdiarias

 function gdiarias($anio = '', $producto = '', $mes = '')
 {
     $this->load->library('Graph');
     $this->lang->load('calendar');
     if (empty($anio)) {
         return;
     }
     $producto = radecode($producto);
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     //echo "fechai=".$fechai;
     //echo "fechaf=".$fechaf;
     $mSQL = "SELECT codigo, LEFT(descrip,20)AS nombre,DAYOFMONTH(a.fecha) as dia,\n    SUM(cantidad)AS cantidad,\n    SUM(importe)AS grantotal\n    FROM itscst  AS a\n    WHERE fecha>='{$fechai}' AND fecha<='{$fechaf}' AND codigo='{$producto}'\n    GROUP BY dia ORDER BY fecha";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->grantotal > $maxval) {
             $maxval = $row->grantotal;
         }
         $fecha[] = $row->dia;
         $nombre = $row->nombre;
         $data_1[] = $row->grantotal;
     }
     $om = 1;
     while ($maxval / $om > 100) {
         $om = $om * 10;
     }
     $bar_1 = new bar(75, '#ADD8E6');
     $bar_1->key('Compras', 10);
     for ($i = 0; $i < count($data_1); $i++) {
         $bar_1->add_data_tip($data_1[$i] / $om, graph::esc(number_format($data_1[$i], 2, ',', '.')));
     }
     $g = new graph();
     $g->set_is_decimal_separator_comma(1);
     if ($maxval > 0) {
         $g->title('Compra de ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:##00264A}');
         $g->data_sets[] = $bar_1;
         $g->set_x_labels($fecha);
         $g->set_x_label_style(9, '#000000', 3, 1);
         $g->set_x_axis_steps(10);
         $g->x_axis_colour('#A6A6A6', '#ADB5C7');
         $g->set_x_legend('Dias', 16, '#004381');
         $g->bg_colour = '#FFFFFF';
         $g->set_tool_tip('#key#<br>Dia: #x_label# <br>Monto: #tip#');
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         $g->y_axis_colour('#A6A6A6', '#ADB5C7');
         $g->set_y_legend('Compras x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
     } else {
         $g->title('No existen compras con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:55,代码来源:productos.php


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