/** @package admin::graphs @author Loaded Commerce @copyright Copyright 2003-2014 Loaded Commerce, LLC @copyright Portions Copyright 2003 osCommerce @license https://github.com/loadedcommerce/loaded7/blob/master/LICENSE.txt @version $Id: banner_yearly.php v1.0 2013-08-08 datazen $ */ function lc_banner_yearly($_id) { global $lC_Database, $lC_Language, $lC_Vqmod; require $lC_Vqmod->modCheck('external/panachart/panachart.php'); $lC_ObjectInfo = new lC_ObjectInfo(lC_Banner_manager_Admin::getData($_id)); $image_extension = lc_dynamic_image_extension(); $views = array(); $clicks = array(); $vLabels = array(); $stats = array(); $Qstats = $lC_Database->query('select year(banners_history_date) as year, sum(banners_shown) as value, sum(banners_clicked) as dvalue from :table_banners_history where banners_id = :banners_id group by year'); $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY); $Qstats->bindInt(':banners_id', $_id); $Qstats->execute(); while ($Qstats->next()) { $stats[] = array($Qstats->valueInt('year'), $Qstats->valueInt('value') > 0 ? $Qstats->valueInt('value') : '0', $Qstats->valueInt('dvalue') > 0 ? $Qstats->valueInt('dvalue') : '0'); $views[] = $Qstats->valueInt('value'); $clicks[] = $Qstats->valueInt('dvalue'); $vLabels[] = $Qstats->valueInt('year'); } $ochart = new chart(600, 350, 5, '#eeeeee'); $ochart->setTitle(sprintf($lC_Language->get('subsection_heading_statistics_yearly'), $lC_ObjectInfo->get('banners_title')), '#000000', 2); $ochart->setPlotArea(SOLID, '#444444', '#dddddd'); $ochart->setFormat(0, ',', '.'); $ochart->setXAxis('#000000', SOLID, 1, ''); $ochart->setYAxis('#000000', SOLID, 2, ''); $ochart->setLabels($vLabels, '#000000', 1, VERTICAL); $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); $ochart->addSeries($views, 'area', 'Series1', SOLID, '#000000', '#0000ff'); $ochart->addSeries($clicks, 'area', 'Series1', SOLID, '#000000', '#ff0000'); $ochart->plot('images/graphs/banner_yearly-' . $_id . '.' . $image_extension); return $stats; }
/** @package admin::graphs @author Loaded Commerce @copyright Copyright 2003-2014 Loaded Commerce, LLC @copyright Portions Copyright 2003 osCommerce @license https://github.com/loadedcommerce/loaded7/blob/master/LICENSE.txt @version $Id: banner_daily.php v1.0 2013-08-08 datazen $ */ function lc_banner_daily($_id, $_month, $_year) { global $lC_Database, $lC_Language, $lC_Vqmod; require $lC_Vqmod->modCheck('external/panachart/panachart.php'); $lC_ObjectInfo = new lC_ObjectInfo(lC_Banner_manager_Admin::getData($_id)); $image_extension = lc_dynamic_image_extension(); $views = array(); $clicks = array(); $vLabels = array(); $days = @date('t', @mktime(0, 0, 0, $_month)) + 1; $stats = array(); for ($i = 1; $i < $days; $i++) { $stats[] = array($i, '0', '0'); $views[$i - 1] = 0; $clicks[$i - 1] = 0; $vLabels[] = $i; } $Qstats = $lC_Database->query('select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from :table_banners_history where banners_id = :banners_id and month(banners_history_date) = :month and year(banners_history_date) = :year'); $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY); $Qstats->bindInt(':banners_id', $_id); $Qstats->bindInt(':month', $_month); $Qstats->bindInt(':year', $_year); $Qstats->execute(); while ($Qstats->next()) { $stats[$Qstats->valueInt('banner_day') - 1] = array($Qstats->valueInt('banner_day'), $Qstats->valueInt('value') > 0 ? $Qstats->valueInt('value') : '0', $Qstats->valueInt('dvalue') > 0 ? $Qstats->valueInt('dvalue') : '0'); $views[$Qstats->valueInt('banner_day') - 1] = $Qstats->valueInt('value'); $clicks[$Qstats->valueInt('banner_day') - 1] = $Qstats->valueInt('dvalue'); } $ochart = new chart(600, 350, 5, '#eeeeee'); $ochart->setTitle(sprintf($lC_Language->get('subsection_heading_statistics_daily'), $lC_ObjectInfo->get('banners_title'), @strftime('%B', @mktime(0, 0, 0, $_month)), $_year), '#000000', 2); $ochart->setPlotArea(SOLID, '#444444', '#dddddd'); $ochart->setFormat(0, ',', '.'); $ochart->setXAxis('#000000', SOLID, 1, ''); $ochart->setYAxis('#000000', SOLID, 2, ''); $ochart->setLabels($vLabels, '#000000', 1, VERTICAL); $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); $ochart->addSeries($views, 'area', 'Series1', SOLID, '#000000', '#0000ff'); $ochart->addSeries($clicks, 'area', 'Series1', SOLID, '#000000', '#ff0000'); $ochart->plot('images/graphs/banner_daily-' . $_id . '_' . $_month . '.' . $image_extension); return $stats; }
$percentage[$i] = ($t[$i]/$total) * 100; }*/ //$vCht4 = array(1,20,20,34,5,52,41,20,34,43,64,40); // $vCht5 = array(12,21,36,27,14,23,3,5,29,23,12,5); // $vCht6 = array(5,7,3,15,7,8,2,2,2,11,22,3); // $vLabels = array('Jan','Feb','Mar','Apr','May','Jun','Jul' //,'Aug','Sep','Oct','Nov','Dec'); if(is_array($barangay)){ $ochart = new chart(400,250,5, '#eeeeee'); //chart($width, $height, $margin, $backgroundColor) $ochart->setTitle('Statistics on Property Locations (By Classification: Market Value)','#000000',2); //setTitle($title, $textColor, $font) $ochart->setPlotArea(SOLID,'#444444', '#dddddd'); //setPlotArea($style, $strokeColor, $fillColor) $ochart->setFormat(0,',','.'); //setFormat($numberOfDecimals, $thousandsSeparator, $decimalSeparator) $ochart->setXAxis('#000000', SOLID, 1, 'Classification'); //setXAxis($color, $style, $font, $title) $ochart->setYAxis('#000000', SOLID, 2, 'Amount'); //setYAxis($color, $style, $font, $title) $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); //setGrid($colorHorizontal, $styleHorizontal, $colorVertical, $styleVertical) $ochart->setLabels($barangay, '#000000', 1, VERTICAL); //setLabels(&$labels, $textColor, $font, $direction) $ochart->addSeries($t,'bar','', SOLID,'#000000', '#0000ff'); //addSeries(&$values, $plotType, $title, $style, $strokeColor, $fillColor) $ochart->plot('graphs/'.$brgyID.''.$classification.'img.png'); //plot($file) $out = fopen("viewGraphs.php", "w"); //fwrite($out,"<a href='t.php'>Back</a><br>"); fwrite($out, "<table cellspacing=5 cellpadding=4 border=0 align='center'>"); // for($i=4; $i<=4; $i++){ $sout.='<tr><td><img border=0 src="graphs/'.$brgyID.''.$classification.'img.png"></td></tr>'; //} fwrite($out, "$sout\n"); fwrite($out, '</table>');
$Qstats = $osC_Database->query('select month(banners_history_date) as banner_month, sum(banners_shown) as value, sum(banners_clicked) as dvalue from :table_banners_history where banners_id = :banners_id and year(banners_history_date) = :year group by banner_month'); $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY); $Qstats->bindInt(':banners_id', $_REQUEST['banners_id']); $Qstats->bindInt(':year', $year); $Qstats->execute(); while ($Qstats->next()) { $stats[$Qstats->valueInt('banner_month') - 1] = array(strftime('%b', mktime(0, 0, 0, $Qstats->valueInt('banner_month'), 1, $year)), $Qstats->valueInt('value') > 0 ? $Qstats->valueInt('value') : '0', $Qstats->valueInt('dvalue') > 0 ? $Qstats->valueInt('dvalue') : '0'); $views[$Qstats->valueInt('banner_month') - 1] = $Qstats->valueInt('value'); $clicks[$Qstats->valueInt('banner_month') - 1] = $Qstats->valueInt('dvalue'); } $vLabels = array(); for ($i = 1; $i < 13; $i++) { $vLabels[] = strftime('%b', mktime(0, 0, 0, $i, 1, $year)); if (!isset($views[$i - 1])) { $views[$i - 1] = 0; } if (!isset($clicks[$i - 1])) { $clicks[$i - 1] = 0; } } $ochart = new chart(600, 350, 5, '#eeeeee'); $ochart->setTitle(sprintf($osC_Language->get('subsection_heading_statistics_monthly'), $title, $year), '#000000', 2); $ochart->setPlotArea(SOLID, '#444444', '#dddddd'); $ochart->setFormat(0, ',', '.'); $ochart->setXAxis('#000000', SOLID, 1, $year); $ochart->setYAxis('#000000', SOLID, 2, ''); $ochart->setLabels($vLabels, '#000000', 1, VERTICAL); $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); $ochart->addSeries($views, 'area', 'Series1', SOLID, '#000000', '#0000ff'); $ochart->addSeries($clicks, 'area', 'Series1', SOLID, '#000000', '#ff0000'); $ochart->plot('images/graphs/banner_monthly-' . $_REQUEST['banners_id'] . '.png');
$month = isset($_REQUEST['month']) && !empty($_REQUEST['month']) ? $_REQUEST['month'] : date('n'); $days = date('t', mktime(0, 0, 0, $month)) + 1; $stats = array(); for ($i = 1; $i < $days; $i++) { $stats[] = array($i, '0', '0'); $views[$i - 1] = 0; $clicks[$i - 1] = 0; $vLabels[] = $i; } $Qstats = $osC_Database->query('select dayofmonth(banners_history_date) as banner_day, banners_shown as value, banners_clicked as dvalue from :table_banners_history where banners_id = :banners_id and month(banners_history_date) = :month and year(banners_history_date) = :year'); $Qstats->bindTable(':table_banners_history', TABLE_BANNERS_HISTORY); $Qstats->bindInt(':banners_id', $_REQUEST['banners_id']); $Qstats->bindInt(':month', $month); $Qstats->bindInt(':year', $year); $Qstats->execute(); while ($Qstats->next()) { $stats[$Qstats->valueInt('banner_day') - 1] = array($Qstats->valueInt('banner_day'), $Qstats->valueInt('value') > 0 ? $Qstats->valueInt('value') : '0', $Qstats->valueInt('dvalue') > 0 ? $Qstats->valueInt('dvalue') : '0'); $views[$Qstats->valueInt('banner_day') - 1] = $Qstats->valueInt('value'); $clicks[$Qstats->valueInt('banner_day') - 1] = $Qstats->valueInt('dvalue'); } $ochart = new chart(600, 350, 5, '#eeeeee'); $ochart->setTitle(sprintf($osC_Language->get('subsection_heading_statistics_daily'), $title, strftime('%B', mktime(0, 0, 0, $month)), $year), '#000000', 2); $ochart->setPlotArea(SOLID, '#444444', '#dddddd'); $ochart->setFormat(0, ',', '.'); $ochart->setXAxis('#000000', SOLID, 1, ''); $ochart->setYAxis('#000000', SOLID, 2, ''); $ochart->setLabels($vLabels, '#000000', 1, VERTICAL); $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); $ochart->addSeries($views, 'area', 'Series1', SOLID, '#000000', '#0000ff'); $ochart->addSeries($clicks, 'area', 'Series1', SOLID, '#000000', '#ff0000'); $ochart->plot('images/graphs/banner_daily-' . $_REQUEST['banners_id'] . '.png');
$ochart = new chart(600,320,5, '#eeeeee'); //chart($width, $height, $margin, $backgroundColor) $ochart->setTitle('Percentage Distribution of Properties (Tax Payment)','#000000',2); //setTitle($title, $textColor, $font) $ochart->setPlotArea(SOLID,'#444444', '#dddddd'); //setPlotArea($style, $strokeColor, $fillColor) $ochart->setFormat(0,',','.'); //setFormat($numberOfDecimals, $thousandsSeparator, $decimalSeparator) $ochart->setXAxis('#000000', SOLID, 1, 'Barangay'); //setXAxis($color, $style, $font, $title) $ochart->setYAxis('#000000', SOLID, 2, 'Tax Payment'); //setYAxis($color, $style, $font, $title) $ochart->setLabels($bar, '#000000', 1, VERTICAL); //setLabels(&$labels, $textColor, $font, $direction) $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); //setGrid($colorHorizontal, $styleHorizontal, $colorVertical, $styleVertical) $ochart->addSeries($percentage,'bar','', SOLID,'#000000', '#0000ff'); //addSeries(&$values, $plotType, $title, $style, $strokeColor, $fillColor) $ochart->plot('graphs/2.png'); //plot($file) */ $ochart = new chart(600,320,5, '#eeeeee'); //chart($width, $height, $margin, $backgroundColor) $ochart->setTitle(' Distribution of Properties (Tax Payment)','#000000',2); //setTitle($title, $textColor, $font) $ochart->setPlotArea(SOLID,'#444444', '#dddddd'); //setPlotArea($style, $strokeColor, $fillColor) $ochart->setFormat(0,',','.'); //setFormat($numberOfDecimals, $thousandsSeparator, $decimalSeparator) $ochart->setXAxis('#000000', SOLID, 1, 'Barangay'); //setXAxis($color, $style, $font, $title) $ochart->setYAxis('#000000', SOLID, 2, 'Tax Payment'); //setYAxis($color, $style, $font, $title) $ochart->setLabels($bar, '#000000', 1, VERTICAL); //setLabels(&$labels, $textColor, $font, $direction) $ochart->setGrid('#bbbbbb', DASHED, '#bbbbbb', DOTTED); //setGrid($colorHorizontal, $styleHorizontal, $colorVertical, $styleVertical) $ochart->addSeries($am,'bar','', SOLID,'#000000', '#0000ff'); //addSeries(&$values, $plotType, $title, $style, $strokeColor, $fillColor) $ochart->plot('graphs/3.png'); //plot($file) */ $out = fopen("viewGraphs.php", "w"); // fwrite($out,"<a href='t.php'>Back</a><br>"); fwrite($out, "<table cellspacing=5 cellpadding=4 border=0 align='center'>"); for($i=2; $i<=3; $i++){ $sout.='<tr><td><img border=0 src="graphs/'.$i.'.png"></td></tr>'; } fwrite($out, "$sout\n"); fwrite($out, '</table>'); fclose($out);
<?php header("content-Type: image/png"); require "./lib/panachart.php"; $vCht4 = array(60, 40, 20, 34, 5, 52, 41, 20, 34, 43, 64, 40); $vCht5 = array(12, 21, 36, 27, 14, 23, 3, 5, 29, 23, 12, 5); $vCht6 = array(5, 7, 3, 15, 7, 8, 2, 2, 2, 11, 22, 3); $vLabels = array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'); $o = new chart(640, 480, 5, '#eeeeee'); $o->setTitle("MegaSena", "#000000", 4); $o->setPlotArea(SOLID, "#444444", '#dddddd'); $o->setFormat(0, ',', '.'); $o->addSeries($vCht4, 'dot', 'n1', SOLID, '#000000', '#0000ff'); $o->addSeries($vCht4, 'line', 'n1', SOLID, '#000000', '#0000ff'); $o->addSeries($vCht5, 'dot', 'n2', SOLID, '#000000', '#0000ff'); $o->addSeries($vCht5, 'line', 'n2', SOLID, '#000000', '#0000ff'); $o->addSeries($vCht6, 'dot', 'n3', SOLID, '#000000', '#0000ff'); $o->addSeries($vCht6, 'line', 'n3', SOLID, '#000000', '#0000ff'); $o->setXAxis('#000000', SOLID, 1, "X Axis"); $o->setYAxis('#000000', SOLID, 2, ""); $o->setLabels($vLabels, '#000000', 1, VERTICAL); $o->setGrid("#bbbbbb", DASHED, "#bbbbbb", DOTTED); $o->plot('');
b1n_getVar('n', $d['n']); if (!b1n_calcCheck($d['ini'], $d['fin'])) { if (!b1n_calcGetMinMax($d['ini'], $d['fin'])) { die('Danou-se...'); } } if ($d['n'] < 1 || $d['n'] > 60) { die('Danou-se...'); } // TODO: implementar a porra do intervalo ini->fin em udf n_inf $ret = b1n_calcGetNumberInfo($d['n']); $dates = b1n_calcGetDates($d['ini'], $d['fin']); $c = new chart(800, 600, 5, '#eeeeee'); $c->setTitle('MegaSena', '#000000', 4); $c->setPlotArea(SOLID, '#444444', '#dddddd'); $c->setXAxis('#000000', SOLID, 2, ''); $c->setYAxis('#000000', SOLID, 2, ''); $c->setFormat(0, ',', '.'); $c->setLabels($dates, '#000000', 1, VERTICAL); $i = 1; $aux = array(); $aux[0] = 0; $v = 0; foreach ($ret as $r) { if (in_array($r['data'], $dates)) { $v = 10; } else { $v = -1; } if ($aux[$i - 1] <= 0) { $v = 0;
$ochart->setLabels($vLabels, '#000000', 1, HORIZONTAL); $ochart->setGrid("#bbbbbb", DOTTED, "#bbbbbb", DOTTED); $ochart->plot("{$k}.png"); $vTime[$k] = microtime() - $iTime; // AREAS LINES $iTime = microtime(); $k++; $ochart1 = new chart(300, 130, 7, '#eeeeee'); $ochart1->setTitle("Area & line", "#000000", 2); $ochart1->setPlotArea(SOLID, "#000000", '#ddeedd'); $ochart1->setFormat(0, ',', '.'); $ochart1->addSeries($vCht5, 'area', 'Series1', SOLID, '#000000', '#ffffaa'); $ochart1->addSeries($vCht6, 'area', 'Series2', SOLID, '#000000', '#ffaaaa'); $ochart1->addSeries($vCht4, 'line', 'Series3', DASHED, '#000000', '#0000ff'); $ochart1->addSeries($vCht4, 'dot', 'Series4', SOLID, '#000000', '#0000ff'); $ochart1->setXAxis('#000000', SOLID, 1, ""); $ochart1->setYAxis('#000000', SOLID, 1, ""); $ochart1->setLabels($vLabels, '#000000', 1, HORIZONTAL); $ochart1->setGrid("#bbbbbb", DOTTED, "#bbbbbb", DOTTED); $ochart1->plot("{$k}.png"); $vTime[$k] = microtime() - $iTime; /* // BAR $iTime = microtime(); $k++; $ochart = new chart(300,130,7, '#eeeeee'); $ochart->setTitle("Bar plot","#000000",2); $ochart->setPlotArea(SOLID,"#aaaaaa", '#ffffff'); $ochart->setFormat(0,',','.'); $ochart->addSeries($vCht5,'bar','Series1', SOLID,'#444444', '#aa4444'); $ochart->setXAxis('#000000', SOLID, 1, ""); $ochart->setYAxis('#000000', SOLID, 1, ""); $ochart->setLabels($vLabels, '#000000', 1, HORIZONTAL);