Exemplo n.º 1
0
        list($Label, $Amount) = $Month;
        $NetFlow[] = number_format($Amount / $Max * 100, 4);
    }
    $Cache->cache_value('torrents_timeline', array($Labels, $InFlow, $OutFlow, $NetFlow, $Max), mktime(0, 0, 0, date('n') + 1, 2));
    //Tested: fine for dec -> jan
}
include_once SERVER_ROOT . '/classes/charts.class.php';
$DB->query("\n\tSELECT tg.CategoryID, COUNT(t.ID) AS Torrents\n\tFROM torrents AS t\n\t\tJOIN torrents_group AS tg ON tg.ID = t.GroupID\n\tGROUP BY tg.CategoryID\n\tORDER BY Torrents DESC");
$Groups = $DB->to_array();
$Pie = new PIE_CHART(750, 400, array('Other' => 1, 'Percentage' => 1));
foreach ($Groups as $Group) {
    list($CategoryID, $Torrents) = $Group;
    $CategoryName = $Categories[$CategoryID - 1];
    $Pie->add($CategoryName, $Torrents);
}
$Pie->transparent();
$Pie->color('FF33CC');
$Pie->generate();
$Categories = $Pie->url();
View::show_header();
?>

<div class="box pad center">
	<h1>Uploads by month</h1>
	<img src="https://chart.googleapis.com/chart?cht=lc&amp;chs=880x160&amp;chco=000D99,99000D,00990D&amp;chg=0,-1,1,1&amp;chxt=y,x&amp;chxs=0,h&amp;chxl=1:|<?php 
echo implode('|', $Labels);
?>
&amp;chxr=0,0,<?php 
echo $Max;
?>
&amp;chd=t:<?php