コード例 #1
0
        WHERE id_tournoi = 3';
$query = new Query($database, $sql);
if ($query->execute()) {
    $playersTMNF = $query->getResult()[0]['nbr'];
}
$sql = 'SELECT COUNT(*) AS nbr FROM joueurtournoi
        WHERE id_tournoi = 5';
$query = new Query($database, $sql);
if ($query->execute()) {
    $playersHS = $query->getResult()[0]['nbr'];
}
$total = $playersHOTS + $playersCOD4 + $playersTMNF + $playersHS;
$data = array($playersHOTS / $total * 100, $playersCOD4 / $total * 100, $playersTMNF / $total * 100, $playersHS / $total * 100);
$labels = array("HOTS\n(%.1f%%)", "COD4\n(%.1f%%)", "TMNF\n(%.1f%%)", "HS\n(%.1f%%)");
$graph = new PieGraph(300, 250);
$graph->ClearTheme();
$graph->SetShadow();
$graph->title->Set('Players Games Ratio');
$graph->title->SetFont(FF_VERDANA, FS_BOLD, 11);
$graph->title->SetColor('black');
$p1 = new PiePlot($data);
$graph->Add($p1);
$p1->SetCenter(0.5, 0.5);
$p1->SetSize(0.25);
$p1->ShowBorder();
$p1->value->SetFormat('%d%%');
$p1->SetGuideLines();
$p1->SetGuideLinesAdjust(1.5);
$p1->SetLabels($labels);
$p1->SetLabelPos(1);
$p1->SetLabelType(PIE_VALUE_ADJPERCENTAGE);