Exemplo n.º 1
0
function PN_BlogStatisticsProcess($target)
{
    global $blogid, $pluginURL, $defaultURL, $blog;
    if (doesHaveOwnership()) {
        include_once 'lib/open-flash-chart.php';
        $grpStyle = $_GET['grpStyle'];
        $grpData = explode("|", $_GET['grpData']);
        $grpTotal = $_GET['grpTotal'];
        $grpYear = $_GET['grpYear'];
        $grpTypeName = $_GET['grpTypeName'];
        $grpLinkType = $_GET['grpLinkType'];
        $grpXLabelType = isset($_GET['grpXLabelType']) ? $_GET['grpXLabelType'] : 0;
        $grpLabel = explode("|", $_GET['grpLabel']);
        $grpSubTitle = array();
        $grpLabelTemp = array();
        if (!empty($_GET['grpData'])) {
            if ($grpTypeName == "category") {
                for ($i = 0; $i < count($grpLabel); $i++) {
                    $grpSubTitle[] = rawurlencode($grpLabel[$i] == 0 ? _t('분류없음') : htmlspecialchars(UTF8::lessenAsEm(getCategoryNameById($blogid, $grpLabel[$i]), 15)));
                }
            } else {
                if ($grpTypeName == "hits" || $grpTypeName == "cmmax" || $grpTypeName == "tbmax" || $grpTypeName == "tagmax") {
                    for ($i = 0; $i < count($grpLabel); $i++) {
                        $grpSubTitle[] = rawurlencode(htmlspecialchars(UTF8::lessenAsEm(str_replace(",", "-", getEntryTitleById($blogid, $grpLabel[$i])), 25)));
                    }
                } else {
                    if ($grpTypeName == "commenter" || $grpTypeName == "tag") {
                        for ($i = 0; $i < count($grpLabel); $i++) {
                            $grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
                            $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 6, ''));
                        }
                        $grpLabel = $grpLabelTemp;
                    } else {
                        if ($grpTypeName == "time") {
                            for ($i = 0; $i < count($grpLabel); $i++) {
                                $grpSubTitle[] = rawurlencode($grpLabel[$i] . "시");
                            }
                        } else {
                            if ($grpTypeName == "refer") {
                                for ($i = 0; $i < count($grpLabel); $i++) {
                                    $tmpHost = explode('.', $grpLabel[$i]);
                                    $tmpHostCnt = count($tmpHost) - 1;
                                    $tmpDomain = (strlen($tmpHost[$tmpHostCnt]) < 3 ? $tmpHost[$tmpHostCnt - 2] . '.' : '') . $tmpHost[$tmpHostCnt - 1] . '.' . $tmpHost[$tmpHostCnt];
                                    $cutDomain = explode('.', $tmpDomain);
                                    $grpSubTitle[] = htmlspecialchars($grpLabel[$i]);
                                    $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($cutDomain[0], 6, ''));
                                }
                                $grpLabel = $grpLabelTemp;
                            } else {
                                if ($grpTypeName == "referkey") {
                                    for ($i = 0; $i < count($grpLabel); $i++) {
                                        $tmpLabel = explode('(', $grpLabel[$i]);
                                        $grpSubTitle[] = htmlspecialchars(UTF8::lessenAsEm($grpLabel[$i], 15));
                                        $grpLabelTemp[] = htmlspecialchars(UTF8::lessenAsEm($tmpLabel[0], 6, ''));
                                    }
                                    $grpLabel = $grpLabelTemp;
                                }
                            }
                        }
                    }
                }
            }
            $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('&nbsp;', '{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();
        }
    }
}
Exemplo n.º 2
0
for($i = 0; $i < $total; $i ++) {
	
	if (( int ) $_GET ['quantidade' . $i] > 0) {
		$_nomes [$i] = $_GET ['nome' . $i];
		$_quantidade [$i] = ( int ) $_GET ['quantidade' . $i];
	}

}

require 'library/open-flash-chart.php';
$g = new graph ( );

//
// PIE chart, 60% alpha
//
$g->pie ( 60, '#FFFFFF' );
$g->bg_colour = '#FFFFFF';
//
// pass in two arrays, one of data, the other data labels
//
$g->pie_values ( $_quantidade, $_nomes );
//
// 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 ( $_CONF['COLORS'] );

$g->set_tool_tip ( '#x_label#<br>#val# itens' );

$g->title ( '', '' );
Exemplo n.º 3
0
$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;');
//
// pass in two arrays, one of data, the other data labels
//
$label = array();
$data = array();
$color = array();
foreach ($cat_fils_annee as $key => $value) {
    $label[] = $key;
    $data[] = $value;
    $id = $oCat->getId($key);
    $color[] = $oCat->getColor($id);
    $val = $oCat->getId($key);
    if (sizeof($oCat->getAllChildren($val)) == 0) {
        $links[] = "javascript:alert('Cette categorie n a pas de sous-categorie')";
    } else {
 /**
  * action_admin_return_ofc_hitrates()
  *
  * the function returns dynamic data (hitrate of apc) and visualizes an piechart with ofc.
  * function consists of 4 segments:
  * (1) get data
  * (2) init ofc
  * (3) draw the chart
  * (4) render it
  *
  * @return dynamic data for an open flash chart
  */
 public function action_admin_return_ofc_hitrates()
 {
     /**
      * (1) get DATA for Visualization
      */
     // get apc cache
     $cache_apc = Clansuite_Cache_Factory::getCache('apc');
     $apc_stats = $cache_apc->stats();
     // debug display of the stats data
     // var_dump($apc_stats);
     // setup the data array
     $data = array();
     $data[] = $apc_stats['cache_info']['num_hits'];
     $data[] = $apc_stats['cache_info']['num_misses'];
     /**
      * (2) initialize Open Flash Chart
      */
     include 'libraries/open-flash-chart/php-ofc-library/open-flash-chart.php';
     $g = new graph();
     /**
      * (3) draw the ofc chart
      */
     // title
     $g->title('APC Hitrate', '{font-size:18px; color: #d01f3c}');
     // ok, now draw one piece of the pie :)
     $g->pie(60, '#505050', '{font-size: 11px; color: #404040;');
     /**
      * we have to pass in 2 arrays
      * (1) $data
      * (2) labels for the data
      */
     $g->pie_values($data, array('Hits', 'Misses'));
     // colours for each slice (hits = green, misses = red)
     $g->pie_slice_colours(array('#acb132', '#d01f3c'));
     // mouseover tooltip displayes the values
     $g->set_tool_tip('#val#');
     /**
      * (4) output/generate the dynamic data for the swf
      */
     echo $g->render();
     // eject here unnicely, because of headers exist error
     // @todo debug and find out, where after $g->render any output is done
     exit;
 }
Exemplo n.º 5
0
}  

if ($type == 'line'){

	$g->set_data($data);
	$g->line_hollow( 2, 4, '#5E83BF', 'Documentos', 10 );

	$g->set_x_labels($labels);
	$g->set_x_label_style( 10, '0x000000', 0, 2 );

	$g->set_y_max( max($data) );
	$g->y_label_steps(4);

}else if ($type == 'pie'){

	$g->pie(60,'#505050','{font-size: 11px; color: #404040}');
	
	$g->pie_values( $data, $labels );
	$g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#FFCC99','#009933','#FF99FF','#33FFFF','#CCCC99','#330033','#00CCFF','#CCCCCC','#FFCC00','#FF0033','#660000','#FFCCCC','#33FF33','#FF6633' ) );

}else{

	$bar = new bar( 95, '#5E83BF', '#424581' );
	//$bar->key( 'documentos', 10 );
	
	$bar->data = $data;
	
	// set the X axis labels
	$g->set_x_labels( $labels );
	
	//$g->set_data( $data );
Exemplo n.º 6
0
function return_ofc_cc()
{
    global $cms, $ps, $pie_slice_colors;
    $styles =& $cms->theme->styles;
    $max = 8;
    // 2 less than the real max (10)
    $data = array();
    $labels = array();
    $exclude = array();
    $total = 0;
    $ps->db->query("SELECT pp.cc,cn,COUNT(*) " . "FROM {$ps->t_plr_profile} pp, {$ps->t_geoip_cc} cc " . "WHERE pp.cc IS NOT NULL AND cc.cc=pp.cc " . "GROUP BY pp.cc " . "ORDER BY 3 DESC LIMIT {$max}");
    while (list($cc, $cn, $cctotal) = $ps->db->fetch_row(0)) {
        $total += $cctotal;
        $data[] = $cctotal;
        $labels[] = '(' . strtoupper($cc) . ") {$cn}";
        $exclude[] = $cc;
    }
    // get 'other' CC's that were not not in the top <$max>
    list($cctotal) = $ps->db->fetch_list("SELECT COUNT(*) " . "FROM {$ps->t_plr_profile} pp, {$ps->t_geoip_cc} cc " . "WHERE pp.cc IS NOT NULL AND cc.cc=pp.cc AND NOT pp.cc IN (" . implode(',', array_map(create_function('$s', 'global $ps; return $ps->db->escape($s,true);'), $exclude)) . ") ");
    $data[] = $cctotal;
    $labels[] = $cms->trans("Other");
    $otheridx = count($data) - 1;
    /**/
    // get a count of players that have no CC defined
    list($cctotal) = $ps->db->fetch_list("SELECT COUNT(*) " . "FROM {$ps->t_plr_profile} pp " . "WHERE pp.cc IS NULL ");
    $data[] = $cctotal;
    $labels[] = $cms->trans("Unknown");
    /**/
    $total = array_sum($data);
    // combine any values that are <= 1%
    if ($otheridx) {
        $extra = 0;
        for ($i = 0; $i < $otheridx; $i++) {
            if ($data[$i] / $total * 100 <= 1.0) {
                $data[$otheridx] += $data[$i];
                unset($data[$i], $labels[$i]);
            }
        }
    }
    // calculate percentages for each value (the OFC pie function only accepts percentages, not absolute values.....)
    $values = array();
    foreach ($data as $d) {
        $v = sprintf("%0.1f", $d / $total * 100);
        if (fmod($v, 1) == 0) {
            $v = round($v);
        }
        $values[] = $v;
    }
    include_once PS_ROOTDIR . '/includes/ofc/open-flash-chart.php';
    $g = new graph();
    $g->bg_colour = $styles->val('flash.pie.bgcolor', 'flash.bgcolor');
    $g->title($styles->val('flash.pie.title', $cms->trans('Country Breakdown'), true), '{' . $styles->val('flash.pie.title.style', 'font-size: 16px', true) . '}');
    $g->pie(75, $styles->val('flash.pie.slices.border', '#505050', true), '{' . $styles->val('flash.pie.labels.style', 'font-size: 12px; display: none', true) . '}');
    $g->pie_values($values, $labels);
    $g->pie_slice_colours($styles->attr_list('flash.pie.slices.slice', 'color', $pie_slice_colors, true));
    $g->set_tool_tip($styles->val('flash.pie.tooltip', '#x_label#<br>#val#%', true));
    // display the data
    print $g->render();
}
Exemplo n.º 7
0
 function CasesByProcessPie()
 {
     $g->bg_colour = '#FFFFFF';
     $dataSet = $this->getCasesByProcess();
     $data = $dataSet['data'];
     $g = new graph();
     $g->pie(80, '#505050', '{font-size: 12px; color: #404040;');
     $g->pie_values($data, $dataSet['labelPie']);
     $g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810', '#D54C78'));
     $g->set_tool_tip('#val# #x_label#');
     $g->title('Cases by Process', '{font-size:16px; color: #d01f3c}');
     echo $g->render();
 }
 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);
 }
/*	} 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();
Exemplo n.º 10
0
 function BugsOpenByUserFlash()
 {
     $dataSet = $this->getBugsOpenByUser();
     $data = $dataSet['data'];
     $g = new graph();
     $g->bg_colour = '#EFFFEF';
     $g->title(' Posts by User last week ' . date("Y-m-d"), '{font-size: 16px;}');
     $g->pie(70, '#505050', '{font-size: 12px; color: #404040;');
     $g->pie_values($data, $dataSet['label']);
     $g->pie_slice_colours(array('#d01f3c', '#356aa0', '#C79810'));
     $g->set_tool_tip('#val# #x_label#');
     $g->title('Bugs by Status', '{font-size:18px; color: #d01f3c}');
     echo $g->render();
     /*
           $dataSet = $this->getBugsOpenByUser();
           $data = $dataSet['data'];
           $g = new graph();
           $g->pie(80,'#505050','{font-size: 12px; color: #404040;');
           $g->pie_values( $data, $dataSet['label'] );
           $g->pie_slice_colours( array('#d01f3c','#356aa0','#C79810','#D54C78') );
           $g->set_tool_tip( '#val# #x_label#' );
           $g->title( 'Open Bugs by User', '{font-size:18px; color: #d01f3c}' );
           echo $g->render();*/
 }
srand ( ( double ) microtime () * 1000000 );

require 'library/open-flash-chart.php';
$g = new graph ( );

$total = (int)$_GET['total'];

$_nomes = array ();
$_quantidade = array ();

for($i = 0; $i < $total; $i ++) {
	
	if (( int )$_GET['quantidade'.$i] > 0) {
		$_nomes[$i] = qtdCaracteres($_GET['nome'.$i],40);
		$_quantidade[$i] = (int)$_GET['quantidade'.$i];
		$links[$i] = "javascript:carrega_dadosfornecedor('".(int)$_GET['id'.$i]."')";
	}

}

$g->bg = '#484848';
$g->pie ( 60, '#484848', '#555555', true, 1 );
$g->bg_colour = '#FFFFFF';
$g->pie_values ( $_quantidade, $_nomes, $links );

$g->pie_slice_colours ( $_CONF['COLORS'] );
$g->set_tool_tip ( '#x_label#<br>#val# produtos' );

echo $g->render ();
?>