Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- // include common.php contents
- include_once('../common/common.php');
- include_once('../config/config.php');
- include_once('../common/constants.php');
- $BF4stats = mysqli_connect(HOST, USER, PASS, NAME, PORT);
- if($BF4stats)
- {
- $query = "SELECT `MapName`, COUNT( `MapName` ) AS number FROM `tbl_mapstats` WHERE `ServerID` = 3 GROUP BY `MapName`";
- $result = mysqli_query($BF4stats, $query);
- if($result)
- {
- while($row = mysqli_fetch_assoc($result))
- {
- foreach($map_array as $val => $key)
- {
- if($key = $row['MapName'])
- {
- $maps[] = $val;
- }
- }
- $number[] = $row['number'];
- }
- include("class/pData.class.php");
- include("class/pDraw.class.php");
- include("class/pPie.class.php");
- include("class/pImage.class.php");
- /* Create and populate the pData object */
- $MyData = new pData();
- $MyData->addPoints($number,"ScoreA");
- $MyData->setSerieDescription("ScoreA","Application A");
- /* Define the absissa serie */
- $MyData->addPoints($maps,"Labels");
- $MyData->setAbscissa("Labels");
- /* Create the pChart object */
- $myPicture = new pImage(300,248,$MyData,TRUE);
- /* Write the picture title */
- $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>12));
- $myPicture->drawText(10,13,"Most played maps in percent",array("R"=>255,"G"=>255,"B"=>255));
- /* Set the default font properties */
- $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>10,"R"=>255,"G"=>255,"B"=>255));
- /* Create the pPie object */
- $PieChart = new pPie($myPicture,$MyData);
- /* Draw an AA pie chart */
- $PieChart->draw2DRing(210,140,array("WriteValues"=>TRUE,"ValueR"=>255,"ValueG"=>255,"ValueB"=>255,"Border"=>TRUE));
- /* Write the legend box */
- $myPicture->setShadow(FALSE);
- $PieChart->drawPieLegend(15,40,array("Alpha"=>0));
- /* Render the picture (choose the best way) */
- $myPicture->autoOutput("pictures/example.draw2DRingValue.png");
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement