Advertisement
Guest User

Untitled

a guest
Dec 23rd, 2013
29
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php  
  2.  
  3. // include common.php contents
  4. include_once('../common/common.php');
  5. include_once('../config/config.php');
  6. include_once('../common/constants.php');
  7. $BF4stats = mysqli_connect(HOST, USER, PASS, NAME, PORT);
  8.  
  9. if($BF4stats)
  10. {
  11.     $query  = "SELECT `MapName`, COUNT( `MapName` ) AS number FROM `tbl_mapstats` WHERE `ServerID` = 3 GROUP BY `MapName`";
  12.     $result = mysqli_query($BF4stats, $query);
  13.     if($result)
  14.     {
  15.         while($row = mysqli_fetch_assoc($result))
  16.         {
  17.             foreach($map_array as $val => $key)
  18.             {
  19.                 if($key = $row['MapName'])
  20.                 {
  21.                     $maps[] = $val;    
  22.                 }
  23.             }
  24.  
  25.             $number[] = $row['number'];
  26.         }
  27.        
  28.         include("class/pData.class.php");
  29.         include("class/pDraw.class.php");
  30.         include("class/pPie.class.php");
  31.         include("class/pImage.class.php");
  32.                
  33.         /* Create and populate the pData object */
  34.         $MyData = new pData();  
  35.         $MyData->addPoints($number,"ScoreA");  
  36.         $MyData->setSerieDescription("ScoreA","Application A");
  37.        
  38.         /* Define the absissa serie */
  39.         $MyData->addPoints($maps,"Labels");
  40.         $MyData->setAbscissa("Labels");
  41.        
  42.         /* Create the pChart object */
  43.         $myPicture = new pImage(300,248,$MyData,TRUE);
  44.        
  45.         /* Write the picture title */
  46.         $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>12));
  47.         $myPicture->drawText(10,13,"Most played maps in percent",array("R"=>255,"G"=>255,"B"=>255));
  48.        
  49.         /* Set the default font properties */
  50.         $myPicture->setFontProperties(array("FontName"=>"fonts/Forgotte.ttf","FontSize"=>10,"R"=>255,"G"=>255,"B"=>255));
  51.            
  52.         /* Create the pPie object */
  53.         $PieChart = new pPie($myPicture,$MyData);
  54.        
  55.         /* Draw an AA pie chart */
  56.         $PieChart->draw2DRing(210,140,array("WriteValues"=>TRUE,"ValueR"=>255,"ValueG"=>255,"ValueB"=>255,"Border"=>TRUE));
  57.        
  58.         /* Write the legend box */
  59.         $myPicture->setShadow(FALSE);
  60.         $PieChart->drawPieLegend(15,40,array("Alpha"=>0));
  61.        
  62.         /* Render the picture (choose the best way) */
  63.         $myPicture->autoOutput("pictures/example.draw2DRingValue.png");
  64.     }
  65. }
  66. ?>
Advertisement
Advertisement
Advertisement
RAW Paste Data Copied
Advertisement