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(' ', '{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(); } } }
$bar->data = $data; // set the X axis labels $g->set_x_labels( $labels ); //$g->set_data( $data ); //$g->bar_sketch( 50, 6, '#99FF00', '#7030A0', '% Complete', 10 ); // add the bar object to the graph // $g->data_sets[] = $bar; $g->set_x_max(count($labels)); $g->set_x_min(count($labels)); $g->set_x_label_style( 11, '#A0A0A0', 2 ); $g->set_y_label_style( 11, '#A0A0A0' ); $g->x_axis_colour( '#A0A0A0', '#FFFFFF' ); //$g->set_x_legend( 'Week 1', 12, '#A0A0A0' ); $g->y_axis_colour( '#A0A0A0', '#FFFFFF' ); $g->set_y_min( min($data) ); $g->set_y_max( max($data) ); $g->y_label_steps( 2 ); } ?> <html> <head> <title><?=$title?></title>
/** */ 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#€'); $g->set_width($width); $g->set_height($height); $g->set_output_type('js'); return $g->render(); }
$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();