</div> </div> <?php foreach ($charts as $title => $data) { ?> <div class="block" style="float:left;margin-right:2em;"> <div class="hd"> <h2><?php echo $title; ?> </h2> </div> <div class="bd"> <?php $gc = new googleChart(implode(',', $data), 'pie'); $gc->setLabels(implode('|', array_keys($data))); $gc->draw(true); ?> </div> </div> <?php } ?> </div></div> </div> <div id="sidebar" class="yui-b"> </div> </div>
/** * Show pie chart for all of the aircraft flown * by a certain pilot. Outputs image, unless $ret == true, * then it returns the URL. */ public static function AircraftFlownGraph($ret = false) { //Select aircraft types $sql = 'SELECT a.name AS aircraft, COUNT(p.aircraft) AS count FROM ' . TABLE_PREFIX . 'pireps p, ' . TABLE_PREFIX . 'aircraft a WHERE p.aircraft = a.id GROUP BY a.name'; $stats = DB::get_results($sql); if (!$stats) { return; } $data = ''; $labels = ''; foreach ($stats as $stat) { if ($stat->aircraft == '') { continue; } $data .= $stat->count . ','; $labels .= $stat->aircraft . '|'; } // remove that final lone char $data = substr($data, 0, strlen($data) - 1); $labels = substr($labels, 0, strlen($labels) - 1); $chart = new googleChart($data, 'pie'); $chart->dimensions = '350x200'; $chart->setLabels($labels); if ($ret == true) { return $chart->draw(false); } else { echo '<img src="' . $chart->draw(false) . '" />'; } }
$opm_fb = clone $opm; $opm_fb->dimensions = '640x400'; // Orders Per Week $order_totals = $db->getRows("SELECT WEEK(dt) as dtstr, COUNT(*) FROM shine_orders WHERE type = 'PayPal' {$where} GROUP BY CONCAT(YEAR(dt), WEEK(dt)) ORDER BY YEAR(dt) ASC, WEEK(dt) ASC"); $opw = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opw->showGrid = 1; $opw->dimensions = '280x100'; $opw->setLabelsMinMax(4, 'left'); $opw_fb = clone $opw; $opw_fb->dimensions = '640x400'; // Orders Per Month Per Application $data = array(); foreach ($applications as $app) { $data[$app->name] = $app->ordersPerMonth(); } $opma = new googleChart(); $opma->smartDataLabel($data); $opma->showGrid = 1; $opma->dimensions = '280x100'; $opma->setLabelsMinMax(4, 'left'); $opma_fb = clone $opma; $opma_fb->dimensions = '640x400'; include 'inc/header.inc.php'; ?> <div id="bd"> <div id="yui-main"> <div class="yui-b"><div class="yui-g"> <div class="block tabs spaces">
<a href="<?php echo $opw_fb->draw(false); ?> " class="fb"><?php $opw->draw(); ?> </a> </div> </div> <?php $db = Database::getDatabase(); // Downloads $sel = "TO_DAYS(dt)"; $order_totals = $db->getRows("SELECT {$sel} as dtstr, COUNT(*) FROM downloads WHERE DATE_ADD(dt, INTERVAL 30 DAY) > NOW() GROUP BY {$sel} ORDER BY {$sel} ASC"); $opw = new googleChart(implode(',', gimme($order_totals, 'COUNT(*)')), 'bary'); $opw->showGrid = 1; $opw->dimensions = '280x100'; $opw->setLabelsMinMax(4, 'left'); $opw_fb = clone $opw; $opw_fb->dimensions = '640x400'; ?> <div class="block"> <div class="hd"> <h2>Downloads 30 Days</h2> </div> <div class="bd"> <a href="<?php echo $opw_fb->draw(false); ?>
function debug($x) { $arr = array($x->strength, $x->dexterity, $x->resistance, $x->intelligence); $moo = new googleChart($arr); $moo->draw(); }