#!/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);
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); }
if (sizeof($oCat->getAllChildren($val)) == 0) { $links[] = "javascript:alert('Cette categorie n a pas de sous-categorie')"; } else { $links[] = "./statsCompte.php?cat_id={$val}"; } } $pie->pie_slice_colours($color); $oSmarty->assign("DEBUG", $debug); $pie->pie_values($data, $label, $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]): // $pie->set_tool_tip('#val#%'); $pie->set_width(650); $pie->set_height(400); $pie->title('Résumé sur l\'année', '{font-size:18px; color: #d01f3c}'); $pie->set_output_type('js'); $ofc2 = $pie->render(); /*************************************/ $oSmarty->assign("OFC", $ofc); $oSmarty->assign("OFC2", $ofc2); $oSmarty->assign("OFC3", $ofc3); // stats $chrono->stop(); $oSmarty->assign("TIME", $chrono->getTime()); $oSmarty->assign("REQUESTS", $mysql->nbRequest); // Affichage du template après compilation $oSmarty->debugging = false; $oSmarty->display('statsCompte.html');
/** */ 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(); }