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


PHP Graph::render方法代码示例

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


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

示例1: grafico

 function grafico($anio = '')
 {
     if (empty($anio)) {
         return;
     }
     $this->load->library('Graph');
     $titulo = $data_1 = $data_2 = $data_3 = $data_tips_1 = $data_tips_2 = $data_tips_3 = array();
     $fechai = $anio . '0101';
     $fechaf = $anio . '1231';
     $data = $this->_sincrodata($fechai, $fechaf);
     $om = 1;
     while ($this->maxval / $om > 100) {
         $om = $om * 10;
     }
     //print_r($data);
     foreach ($data as $row) {
         $titulo[] = $row['mes'];
         $data_1[] = $row['contado'] / $om;
         $data_2[] = $row['credito'] / $om;
         $data_3[] = $row['cobrado'] / $om;
         $data_tips_1[] = graph::esc(number_format($row['contado'], 2, ',', '.'));
         $data_tips_2[] = graph::esc(number_format($row['credito'], 2, ',', '.'));
         $data_tips_3[] = graph::esc(number_format($row['cobrado'], 2, ',', '.'));
     }
     $odata_1 = new bar_fade(50, '0xCC3399');
     $odata_1->key('Contado', 10);
     $odata_1->data = $data_1;
     $odata_1->tips = $data_tips_1;
     $odata_2 = new bar_fade(50, '0x80a033');
     $odata_2->key('Crédito', 10);
     $odata_2->data = $data_2;
     $odata_2->tips = $data_tips_2;
     $odata_4 = new line_hollow(2, 3, '0x9933CC');
     $odata_4->key('Cobranzas a Crédito', 10);
     $odata_4->data = $data_3;
     $odata_4->tips = $data_tips_3;
     for ($i = 0; $i < count($data_1); $i++) {
         $mes = $i + 1;
         $odata_1->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
         $odata_2->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
         $odata_3->links[] = site_url("/hospitalidad/mensuales/index/{$mes}/{$anio}");
     }
     $g = new Graph();
     $g->set_is_decimal_separator_comma(1);
     if ($this->maxval > 0) {
         $g->title('Ventas en el a&ntilde;o ' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->data_sets[] = $odata_1;
         $g->data_sets[] = $odata_2;
         $g->data_sets[] = $odata_4;
         $g->set_y_max(ceil($this->maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titulo);
         $ejey = number_format($om, 0, '', ' ');
         $g->set_y_legend('Venta X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('Meses', 14, '0x639F45');
         $g->set_tool_tip('#key#<br>Mes: #x_label# <br>Monto: #tip#');
     } else {
         $g->title('NO existen ventas en el a&ntilde;o seleccionado', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:62,代码来源:anuales.php

示例2: grafico

 function grafico($mes = NULL, $anio = NULL)
 {
     if (empty($mes) and empty($anio)) {
         return;
     }
     $this->load->library('Graph');
     $titulo = $data_1 = $data_2 = $data_3 = $data_tips_1 = $data_tips_2 = $data_tips_3 = array();
     $fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
     $fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
     $data = $this->_sincrodata($fechai, $fechaf);
     $om = 1;
     while ($this->maxval / $om > 100) {
         $om = $om * 10;
     }
     foreach ($data as $row) {
         $titulo[] = $row['dia'];
         $data_1[] = $row['contado'] / $om;
         $data_2[] = $row['credito'] / $om;
         $data_3[] = $row['cobrado'] / $om;
         $data_tips_1[] = graph::esc(number_format($row['contado'], 2, ',', '.'));
         $data_tips_2[] = graph::esc(number_format($row['credito'], 2, ',', '.'));
         $data_tips_3[] = graph::esc(number_format($row['cobrado'], 2, ',', '.'));
     }
     $odata_1 = new bar_fade(50, '0xCC3399');
     $odata_1->key('Contado', 10);
     $odata_1->data = $data_1;
     $odata_1->tips = $data_tips_1;
     $odata_2 = new bar_fade(50, '0x80a033');
     $odata_2->key('Cr&eacute;dito', 10);
     $odata_2->data = $data_2;
     $odata_2->tips = $data_tips_2;
     $odata_3 = new line_hollow(2, 3, '0x9933CC');
     $odata_3->key('Cobranzas a Cr&eacute;dito', 10);
     $odata_3->data = $data_3;
     $odata_3->tips = $data_tips_3;
     $g = new Graph();
     if ($this->maxval > 0) {
         $g->title('Ventas del mes ' . $mes . '/' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->set_is_decimal_separator_comma(1);
         $g->data_sets[] = $odata_3;
         $g->data_sets[] = $odata_1;
         $g->data_sets[] = $odata_2;
         $g->set_y_max(ceil($this->maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titulo);
         $ejey = number_format($om, 0, '', '.');
         $g->set_y_legend('Venta X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('D&iacute;as del mes ' . $mes, 14, '0x639F45');
         $g->set_tool_tip('#key#<br>D&iacute;a: #x_label# <br>Monto: #tip#');
     } else {
         $g->title('No existen ventas en la Fecha Seleccionada', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     //$g->set_bg_image(site_url('/images/ventafon.png'), 'center', 'middle' );
     echo utf8_encode($g->render());
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:56,代码来源:mensuales.php

示例3: grafico

 function grafico()
 {
     $this->load->library('Graph');
     $data = array();
     $dia = array();
     $mSQL = "SELECT if(b.tipo IS NULL,a.tipo,b.nombre) nombre, sum(a.monto*(SUBSTRING(a.numero,1,1)<>'X')) monto\n\t\t\t FROM viepag a LEFT JOIN tarjeta b ON a.tipo=b.tipo\n\t\t\t WHERE fecha BETWEEN 20070101 AND 20070131 \n\t\t\t GROUP BY a.tipo ORDER BY monto DESC";
     $res = $this->db->query($mSQL) or die("Bad SQL 1");
     $total = 0;
     foreach ($res->result() as $row) {
         if ($row->monto < 0) {
             $total += $row->monto * -1;
         } else {
             $total += $row->monto;
         }
     }
     $res->first_row();
     foreach ($res->result() as $row) {
         $titu[] = substr($row->nombre, 0, 20);
         if ($row->monto < 0) {
             $data[] = round($row->monto * 100 / $total * -1, 0);
         } else {
             $data[] = round($row->monto * 100 / $total, 0);
         }
     }
     // use the chart class to build the chart:
     $g = new Graph();
     $g->title('DISTRIBUCION DE LA COBRANZA ', '{font-size:18px; color: #d01f3c}');
     $g->set_data($data);
     $g->bar_filled(80, '#9933CC', '#8010A0', '', 10);
     $g->set_y_max(100);
     $g->bg_colour = '#FFFFFF';
     $g->y_label_steps(5);
     $g->set_x_labels($titu);
     $g->set_y_legend('Porcentaje de Venta', 14, '0x639F45');
     $g->set_x_legend('Forma de Pago', 14, '0x639F45');
     $g->set_bg_image(site_url('/images/ventafon.png'), 'center', 'middle');
     $g->set_tool_tip('#val#%25');
     echo $g->render();
     $res->free_result();
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:40,代码来源:supermercadosant.php

示例4: create_graph

function create_graph($type, $range = null)
{
    global $db;
    // Do we have date range criteria?
    if ($range['end'] || $range['start']) {
        $start = (int) $range['start'];
        $end = (int) $range['end'];
    } else {
        $start = TIME_NOW - 60 * 60 * 24 * 30;
        $end = TIME_NOW;
    }
    $allowed_types = array('users', 'threads', 'posts');
    if (!in_array($type, $allowed_types)) {
        die;
    }
    require_once MYBB_ROOT . 'inc/class_graph.php';
    $points = $stats = $datelines = array();
    if ($start == 0) {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline <= '" . (int) $end . "'", array('order_by' => 'dateline', 'order_dir' => 'desc', 'limit' => 2));
        while ($stat = $db->fetch_array($query)) {
            $stats[] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
        $points[$datelines[0]] = 0;
        $points[$datelines[1]] = $stats[0] - $stats[1];
        ksort($points, SORT_NUMERIC);
    } elseif ($end == 0) {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '" . (int) $start . "'", array('order_by' => 'dateline', 'order_dir' => 'asc', 'limit' => 2));
        while ($stat = $db->fetch_array($query)) {
            $stats[] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
        $points[$datelines[0]] = 0;
        $points[$datelines[1]] = $stats[1] - $stats[0];
        ksort($points, SORT_NUMERIC);
    } else {
        $query = $db->simple_select("stats", "dateline,num{$type}", "dateline >= '" . (int) $start . "' AND dateline <= '" . (int) $end . "'", array('order_by' => 'dateline', 'order_dir' => 'asc'));
        while ($stat = $db->fetch_array($query)) {
            $points[$stat['dateline']] = $stat['num' . $type];
            $datelines[] = $stat['dateline'];
            $x_labels[] = date("m/j", $stat['dateline']);
        }
    }
    sort($datelines, SORT_NUMERIC);
    // Find our year(s) label
    $start_year = date('Y', $datelines[0]);
    $last_year = date('Y', $datelines[count($datelines) - 1]);
    if ($last_year - $start_year == 0) {
        $bottom_label = $start_year;
    } else {
        $bottom_label = $start_year . " - " . $last_year;
    }
    // Create the graph outline
    $graph = new Graph();
    $graph->add_points(array_values($points));
    $graph->add_x_labels($x_labels);
    $graph->set_bottom_label($bottom_label);
    $graph->render();
    $graph->output();
}
开发者ID:olada,项目名称:mybbintegrator,代码行数:62,代码来源:statistics.php

示例5: DateTimeZone

             if (!isset($_GET['date_from'])) {
                 die;
             }
             $dateFrom = DateTime::createFromFormat($date_format, $_GET['date_from'], new DateTimeZone(TIME_ZONE));
             $graph = new Graph();
             $graph->alchemyApiKey = ALCHEMY_API_KEY;
             $graph->dateFrom = $dateFrom->format('Y-m-d');
             $graph->maxDreams = MAX_DISPLAYED_DREAMS;
             $graph->maxKeywords = 30;
             $graph->minTagValue = MIN_TAG_VALUE;
             if (isset($_GET['date_to'])) {
                 $dateTo = DateTime::createFromFormat($date_format, $_GET['date_to'], new DateTimeZone(TIME_ZONE));
                 $graph->dateTo = $dateTo->format('Y-m-d');
             }
             $graph->build();
             $data = $graph->render();
             $data->date_from = date($date_format, strtotime($graph->dateFrom));
             $data->date_to = date($date_format, strtotime($graph->dateTo));
             $response->result = $data;
             if (isset($_SESSION['submission']) && $_SESSION['submission'] == 1) {
                 $highlightColor = "#cc3300";
                 $dream = (object) array('id' => '-1', 'user_id' => '-1', 'description' => 'Your dream here', 'color' => $highlightColor, 'color2' => $highlightColor, 'index' => $graph->getNodeCount(), 'interactive' => false, 'node_type' => 'dream', 'tags' => array(), 'value' => 0);
                 $dreams[] = $dream;
                 $nodes[] = $dream;
                 unset($_SESSION['submission']);
             }
             break;
     }
     break;
 case "dates":
     switch ($_SERVER['REQUEST_METHOD']) {
开发者ID:npedrini,项目名称:artefacts,代码行数:31,代码来源:index.php

示例6: buildGraphicByYearFlash

 /**
  * Método que cria um gráfico de estatisticas de acesso pela classe Graph do pacote
  * Open Chart Flash http://sourceforge.net/projects/o-flash-chart/
  * 
  * @author Deivid Martins
  * @access public
  * @param Object $stats
  * @param Integer $startYear
  * @param Integer $lastYear
  * @return Boolean $graficoStatus se o gráfico foi montado ou não
  **/
 function buildGraphicByYearFlash($stats, $startYear, $lastYear)
 {
     $graph = new Graph();
     $graficoStatus = false;
     // Se existem ou não estatisticas
     $dadosRequeridos = array();
     // Estatisticas que usuario pediu
     $maximo = 0;
     // Maior valor do gráfico
     // Gabarito de cores para linhas do gráfico
     $cores = array("#191970", "#FFA500", "#A020F0", "#008B8B", "#CD1076", "#FF0000", "#A0522D", "#66CDAA", "#8B8B7A", "#FFB5C5", "#8B0000", "#006400");
     // DarkGreen
     $stat = $stats->getRequests();
     foreach ($stat as $s) {
         $mes = intval($s->getMonth());
         $ano = intval($s->getYear());
         if ($s->getNumberOfRequests() == "") {
             $values[$ano][$mes] = 0;
         } else {
             $values[$ano][$mes] = $s->getNumberOfRequests();
         }
     }
     // Montamos o gráfico
     //$graph->title( utf8_encode(ARTICLE_ACCESS), 14, '#000000' );
     //Estamos montando o titulo no html
     $graph->bg_colour = '#FFFFFF';
     $graph->set_inner_background('#F8F8FF', '#CBD7E6', 90);
     // Somente monta o gráfico dos anos exigidos pelo usuário
     for ($i = 0; $i <= $lastYear - $startYear; $i++) {
         $dadosRequeridos[$i] = range(0, 11);
         $graficoStatus = true;
         // entrou no for significa que o gráfico vai ser construido
         for ($j = 0; $j < 12; $j++) {
             /*	Tem alguns meses que não existem estatisticas e retorna null
             				e o php retorna o array quebrado
             				Ex: ([0] => 5, [1] => 7, [5] => 6) pulando alguns elementos
             			*/
             if (is_null($values[$startYear + $i][$j + 1])) {
                 $dadosRequeridos[$i][$j] = 'null';
             } else {
                 $dadosRequeridos[$i][$j] = $values[$startYear + $i][$j + 1];
             }
         }
         // Procuramos o maior valor daquele ano
         $tempMax = max($values[$startYear + $i]);
         if ($tempMax > $maximo) {
             $maximo = $tempMax;
         }
         // Criamos a linha de um determinado ano
         $graph->set_data($dadosRequeridos[$i]);
         $graph->line_hollow(2, 3, $cores[$i], $startYear + $i, 11);
         $graph->set_tool_tip(ACCESSES . ': #val#');
     }
     // Não existem dados, portanto o gráfico não deve ser montado
     if ($graficoStatus == false) {
         return $graficoStatus;
     }
     // Dados eixo X
     $graph->set_x_labels(explode(",", MONTH_LIST));
     $graph->set_x_label_style(11, '#333333', 2);
     // Valor máximo do eixo Y
     $graph->set_y_max($maximo + 2);
     $graph->set_y_label_style(11, '#333333');
     $graph->y_label_steps(4);
     // Legendas eixo X e Y
     $graph->set_x_legend(MONTHS, 12, '#444444');
     $graph->set_y_legend(ACCESSES, 12, '#444444');
     $graph->set_x_tick_size(10);
     // Cores da grade
     $graph->x_axis_colour('#68838B', '#FFFFFF');
     $graph->y_axis_colour('#68838B', '#FFFFFF');
     // Mostra o gráfico somente se, o ano que o usuario entrou existir estatisticas
     if ($graficoStatus == true) {
         echo $graph->render();
     }
     return $graficoStatus;
 }
开发者ID:robertatakenaka,项目名称:Proceedings,代码行数:88,代码来源:AccessServiceBar.php

示例7: departa

 function departa()
 {
     $this->load->library('Graph');
     $data = $titu = array();
     $mes = $this->uri->segment(4);
     $anio = $this->uri->segment(5);
     if (empty($mes) and empty($anio)) {
         return;
     }
     $fechai = $anio . $mes . '01';
     $fechaf = $anio . $mes . '31';
     //8471.49.00.00
     $mSQL = "SELECT f.descrip etiqueta, sum(b.importe) total\n\t\t\tFROM itscst b JOIN scst a ON a.control=b.control \n\t\t\tJOIN sinv c ON b.codigo=c.codigo\n\t\t\tJOIN grup d ON d.grupo=c.grupo\n\t\t\tJOIN line e ON d.linea=e.linea \n\t\t\tJOIN dpto f ON e.depto=f.depto \n\t\t\tWHERE a.tipo_doc IN ('FC', 'NC','NE') AND a.fecha>={$fechai} AND a.fecha<={$fechaf}\n\t\t\tGROUP BY f.depto";
     //echo $mSQL;
     $maxval = 0;
     $query = $this->db->query($mSQL);
     foreach ($query->result() as $row) {
         if ($row->total > $maxval) {
             $maxval = $row->total;
         }
         $data[] = $row->total;
         $titu[] = $row->etiqueta;
     }
     $i = 1;
     while (1) {
         if ($maxval / $i <= 100) {
             break;
         }
         $i = $i * 10;
     }
     $om = $i;
     $i = 0;
     //$om=1;
     for ($i = 0; $i < count($data); $i++) {
         $data[$i] = $data[$i] / $om;
     }
     $g = new Graph();
     if ($maxval > 0) {
         $g->title('COMPRAS DEL ' . $mes . '/' . $anio, '{font-size:18px; color: #d01f3c}');
         $g->set_data($data);
         $g->bar_glass(55, '#5E83BF', '#424581', 'Compras', 10);
         $g->set_y_max(ceil($maxval / $om));
         $g->y_label_steps(5);
         $g->set_x_labels($titu);
         $ejey = number_format($om, 0, '', ' ');
         $g->set_y_legend('Compras X ' . $ejey . ' (Bs)', 14, '0x639F45');
         $g->set_x_legend('Grupos ' . $mes, 14, '0x639F45');
         //$g->pie(60,'#505050','#000000');
         //$g->pie_values( $data, $titu );
         //$g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#5E83BF'));
         $g->set_tool_tip('#key#<br>Departamento: #x_label# <br>Monto: #val# x ' . $ejey);
     } else {
         $g->title('NO EXISTEN VENTAS EN LA FECHA SELECCIONADA', '{font-size:18px; color: #d01f3c}');
     }
     $g->bg_colour = '#FFFFFF';
     //$g->set_bg_image(site_url('/images/ventafon.png'), 'center', 'middle' );
     echo $g->render();
     $query->free_result();
 }
开发者ID:codethics,项目名称:proteoerp,代码行数:59,代码来源:analisis.php


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