本文整理汇总了PHP中graph::set_tool_tip方法的典型用法代码示例。如果您正苦于以下问题:PHP graph::set_tool_tip方法的具体用法?PHP graph::set_tool_tip怎么用?PHP graph::set_tool_tip使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类graph
的用法示例。
在下文中一共展示了graph::set_tool_tip方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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());
}
示例2: gdiarias
function gdiarias($anio = '', $concep = '', $mes = '')
{
$this->load->library('Graph');
$this->lang->load('calendar');
if (empty($anio) or empty($concep)) {
return;
}
$fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
$fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
$mSQL = "SELECT a.fecha,a.concep,SUM(a.monto)AS grantotal,b.nombre,DATE_FORMAT(fecha,'%d') AS dia\n\t\tFROM est_pago as a JOIN banc as b ON a.concep=b.codbanc\n\t\tWHERE fecha>='{$fechai}' AND fecha<='{$fechaf}' AND a.concep='{$concep}'\n\t\tGROUP BY fecha ORDER BY fecha ASC";
//echo $mSQL;
$maxval = 0;
$query = $this->db->query($mSQL);
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$dia[] = $row->dia;
$data_1[] = $row->grantotal;
}
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar(55, '#07A8E7');
$bar_1->key('Monto', 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('Ventas de el' . $mes . '/' . $anio, 'concep de pago' . $concep, '{font-size: 16px; color:##00264A}');
$g->data_sets[] = $bar_1;
$g->x_axis_colour('#A6A6A6', '#ADB5C7');
$g->set_x_labels($dia);
$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->y_axis_colour('#A6A6A6', '#ADB5C7');
$g->set_y_legend('Ventas x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
} else {
$g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}
示例3: gdiarias
function gdiarias($anio = '', $cliente = '', $mes = '')
{
$this->load->library('Graph');
if (empty($mes) or empty($anio) or empty($cliente)) {
return;
}
$fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
$fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
$mSQL = "SELECT cod_cli,nombre,fecha,DAYOFMONTH(fecha) as dia, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS grantotal, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS contado, \n\t\tsum(gtotal*IF(tipo='D', -1, 1)) AS credito \n\t\tFROM fmay \n\t\tWHERE tipo<>'X' AND fecha>='{$fechai}' AND fecha<='{$fechaf}' AND cod_cli='{$cliente}' \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;
$data_1[] = $row->contado;
$data_2[] = $row->credito;
$data_3[] = $row->grantotal;
}
$nombre = $row->nombre;
$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, ',', '.')));
}
$g = new graph();
$g->set_is_decimal_separator_comma(1);
if ($maxval > 0) {
$g->title('Compras de el cliente ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:#0F3054}');
$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('hospitalidad x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
} else {
$g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}
示例4: 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();
}
}
}
示例5: 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());
}
示例6: yf_autoloader
#!/usr/bin/php
<?php
$config = ['git_urls' => ['https://github.com/yfix/yf_open_flash_chart.git' => 'yf_open_flash_chart/'], 'require_once' => ['yf_open_flash_chart/open-flash-chart.php'], 'example' => function () {
$bar = new bar_outline(70, '#A2C2FC', '#0750D9');
$bar->data = [];
$g = new graph();
$g->js_path = isset($params['js_path']) ?: '/js/';
$g->swf_path = isset($params['swf_path_path']) ?: '/js/';
$g->title(' ', '{font-size: 20px;}');
$g->set_tool_tip('#val# EUR on #x_label#');
$g->set_output_type('js');
echo $g->render();
}];
if ($return_config) {
return $config;
}
require_once __DIR__ . '/_yf_autoloader.php';
new yf_autoloader($config);
示例7: gproducto
function gproducto($anio = '', $depto = '', $fami = '', $grupo = '')
{
$this->load->library('Graph');
if (empty($anio)) {
return;
}
$fechai = $anio . '0101';
$fechaf = $anio . '1231';
$mSQL = "SELECT a.codigo,a.depto,a.familia,a.grupo,e.descrip as nombre,\n\t\tSUM(a.monto) AS grantotal, \n\t\tSUM(a.costo) AS costo, \n\t\tSUM(a.cantidad) AS cantidad,\n\t\tSUM(a.monto)-SUM(a.costo) AS ganancia\n\t\tFROM est_item AS a\n\t\tJOIN maes AS e ON a.codigo= e.codigo\n\t\tWHERE a.fecha>='{$fechai}' AND a.fecha<='{$fechaf}' AND a.depto='{$depto}' AND a.familia='{$fami}' AND a.grupo='{$grupo}'\n\t\tGROUP BY a.codigo LIMIT 10";
//echo $mSQL;
$maxval = 0;
$query = $this->db->query($mSQL);
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$nombre[] = $row->nombre;
$famili = $row->famili;
$dpto = $row->dpto;
$grup = $row->grup;
$data_1[] = $row->grantotal;
$data_2[] = $row->ganancia;
}
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar_fade(55, '#C31812');
$bar_2 = new bar_fade(55, '#424581');
$bar_1->key('Total', 10);
$bar_2->key('Ganancias', 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, ',', '.')));
}
$g = new graph();
$g->set_is_decimal_separator_comma(1);
if ($maxval > 0) {
$g->title('Ventas de el año ' . $anio, '{font-size: 16px; color:#0F3054}');
$g->data_sets[] = $bar_1;
$g->data_sets[] = $bar_2;
$g->set_x_labels($nombre);
$g->set_x_label_style(10, '#000000', 2, 1);
$g->set_x_axis_steps(10);
$g->set_x_legend('Productos', 14, '#004381');
$g->bg_colour = '#FFFFFF';
$g->set_tool_tip('#key#<br>Producto: #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');
} else {
$g->title('No existen ventas en el año seleccionado', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}
示例8: 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ñ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());
}
示例9: gmensuales
function gmensuales($mes = '', $anio = '')
{
$this->load->library('Graph');
$this->lang->load('calendar');
if (empty($anio) or empty($mes)) {
return;
}
$fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
$fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
$mSQL = "SELECT DAYOFMONTH(fecha)AS dia,\r\n SUM(monto)AS grantotal\r\n FROM pres \r\n WHERE fecha>='{$fechai}' AND fecha<='{$fechaf}'\r\n GROUP 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;
$data_1[] = $row->grantotal;
}
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar(75, '#329B98');
$bar_1->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, ',', '.')));
}
$g = new graph();
$g->set_is_decimal_separator_comma(1);
if ($maxval > 0) {
$g->title('Prestamos de el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:#0F3054}');
$g->data_sets[] = $bar_1;
$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', 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->set_y_legend('Prestamos x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
} else {
$g->title('No existen prestamos con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}
示例10: 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ás altos en el añ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());
}
示例11: 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);
}
示例12: gmensuales
function gmensuales($anio = '', $cliente = '')
{
$this->load->library('Graph');
if (empty($anio) or empty($cliente)) {
return;
}
$fechai = $anio . '0101';
$fechaf = $anio . '1231';
$mSQL = "SELECT cliente,nombres,DATE_FORMAT(fecha,'%m')AS mes, SUM(gtotal)AS grantotal, SUM(impuesto)AS impuesto \n\t\tFROM viefac \n\t\tWHERE tipo<>'X' AND fecha>='{$fechai}' AND fecha<='{$fechaf}' AND cliente='{$cliente}' \n\t\tGROUP BY MONTH(fecha) ORDER BY fecha";
//echo $mSQL;
$maxval = 0;
$query = $this->db->query($mSQL);
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$nombre = $row->nombres;
$mes[] = $row->mes;
$data_1[] = $row->grantotal;
}
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar(75, '#8E4B97');
$bar_1->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_1->links[]= site_url("supermercado/clientes/diarias/$anio/$cliente/$mes[$i]");
}
$g = new graph();
$g->set_is_decimal_separator_comma(1);
if ($maxval > 0) {
$g->title('Compras de el cliente ' . $nombre . ' en el año ' . $anio, '{font-size: 16px; color:#0F3054}');
$g->data_sets[] = $bar_1;
$g->set_x_labels($mes);
$g->set_x_label_style(10, '#000000', 3, 1);
$g->set_x_axis_steps(10);
$g->set_x_legend('Meses', 14, '#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('supermercado x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
} else {
$g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}
示例13: 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();
示例14: array
$data = array();
// include_once(SITE_OFC.'ofc-library/open-flash-chart.php');
$bar = new bar_outline(50, '#1D6DC2', '#000000');
$max = 0;
$sql = "SELECT pr.vProdName, count( ord.iOrderId ) AS Totodr\r\nFROM " . PRJ_DB_PREFIX . "_product AS pr, " . PRJ_DB_PREFIX . "_order AS ord\r\nWHERE pr.iProductId = ord.iProductId\r\nGROUP BY ord.iProductId\r\nORDER BY ord.iOrderId DESC\r\nLIMIT 0 , 5";
$db_sql = $dbobj->MySQLSelect($sql);
for ($i = 0; $i < count($db_sql); $i++) {
$data[] = substr(stripslashes($db_sql[$i]['vProdName']), 0, 8) . "...";
$Adata = $db_sql[$i]['Totodr'];
$tip = "Product Name : " . $db_sql[$i]['vProdName'] . "<br>";
$tip .= "Total Order : " . $db_sql[$i]['Totodr'] . "<br>";
$bar->add_data_tip($Adata, $tip);
if ($max != $db_sql[$i]['Totodr']) {
if ($max < $db_sql[$i]['Totodr']) {
$max = $db_sql[$i]['Totodr'];
}
}
}
$g = new graph();
$g->bg_colour = 'FBFBFB';
$g->title('Most Ordered Product ', '{font-size: 18px;}');
$g->set_tool_tip('#tip#');
$g->data_sets[] = $bar;
$g->set_x_labels($data);
$g->set_x_label_style(10, '#000000', 2, 1);
$g->set_x_axis_steps(1);
$g->set_y_max($max);
$g->y_label_steps(5);
$g->set_y_label_style(10, '#000000');
$g->set_y_legend('Total Order', 12, '#000000');
echo $g->render();
示例15: gdiarias
function gdiarias($anio = '', $producto = '', $mes = '')
{
$this->load->library('Graph');
if (empty($mes) or empty($anio) or empty($producto)) {
return;
}
$fechai = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '01';
$fechaf = $anio . str_pad($mes, 2, "0", STR_PAD_LEFT) . '31';
$mSQL = "SELECT a.codigo AS codigo,b.descrip AS nombre,DAYOFMONTH(a.fecha) as dia,a.cantidad AS cantidad,\n SUM(a.venta)AS grantotal \n FROM costos AS a \n JOIN maes AS b ON a.codigo=b.codigo\n WHERE a.fecha >='{$fechai}' AND a.fecha <='{$fechaf}' AND a.codigo='{$producto}'\n GROUP BY fecha ORDER BY grantotal DESC";
echo $mSQL;
$maxval = 0;
$query = $this->db->query($mSQL);
foreach ($query->result() as $row) {
if ($row->grantotal > $maxval) {
$maxval = $row->grantotal;
}
$fecha[] = $row->dia;
$data_1[] = $row->grantotal;
}
$nombre = $row->nombre;
$om = 1;
while ($maxval / $om > 100) {
$om = $om * 10;
}
$bar_1 = new bar(75, '#0F235F');
$bar_1->key('supermercado', 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('Ventas de ' . $nombre . ' en el mes ' . $mes . '/' . $anio, '{font-size: 16px; color:#0F3054}');
$g->data_sets[] = $bar_1;
$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('supermercado x ' . number_format($om, 0, '', '.') . ' (Bs)', 16, '#004381');
} else {
$g->title('No existen ventas con los datos seleccionados', '{font-size:18px; color: #d01f3c}');
}
$g->bg_colour = '#FFFFFF';
echo utf8_encode($g->render());
}