Location: PHPKode > projects > D4WStatsLittle - Web Stats System > d4wstatslittle-web-stats-system/Install Without Using Dreamweaver/d4wstatslittle/report/reportes/tools/piechart.php
<?php
/*
+--------------------------------------------------------------------------
|   D4WStatsLittle v1.1.2 - Developers4Web Web Stats Software
|   ==========================================================
|   by Developers4Web.com
|	D4WStatsLittle is a Trade Mark of Developers4Web
|   Copyright Developers4Web 2005 - 2006. All rights reserved.
|   English:
|       http://stats-service.developers4web.com
|   Español:
|       http://www.developers4web.com
|   ========================================
|   optimized by Trio Solutions
|   Dreamweaver Extensions and Web Development Components 
|   English:
|       http://components.developers4web.com
|   Español:
|       http://componentes.developers4web.com
|   ========================================
|   Web: http://www.d4wstats.com
|   Date: Tuesday, February 20, 2006
|   Email: info (at) developers4web (dot) com
|	License Type: D4WSTATSLITTLE is NOT Open Source Software and Limitations Apply 
|   Licence Info: /d4wstatslittle/license.txt
+--------------------------------------------------------------------------
*/
?>
<?PHP
 
  header ("Content-type: image/png");

  
  require "./colors.inc.php";  
  
  
  
  ////checkLogin();  
  
  $width = 150;  
    
  
  $count = $_GET["c"];
      
  for ($i=0; $i<$count;$i++)
  {
      $content [$i]['name']='a';
      $content [$i]['value']=$_GET["i".$i];
      $content [$i]['color']=$color[$i % 16][0];
  }
  
  $im = @imagecreate ($width+2, $width/2+10)
      or die ("Cannot Initialize new GD image stream");
  $background_color = imagecolorallocate ($im, 255, 255, 255);
  $text_color = imagecolorallocate ($im, 255, 255, 0);

  $start = $width/4 + 10;
  for ($k=0;$k<11;$k++)
  {

      $angleStart = 0;
      for ($i = count($content)-1; $i >=0; $i--)
      {
          $angle = $content[$i]['value']*360/100;
          if ($k == 10)
              imagefilledarc($im,$width/2,$start-10,$width,$width-$width/2,$angleStart,$angleStart + $angle,imagecolorallocate ($im, $color[$i%16][1], $color[$i%16][2], $color[$i%16][3]),IMG_ARC_PIE);
          else
          {    
              if ($angleStart < 180)
                  if ($angleStart + $angle < 180)
                      imagefilledarc($im,$width/2,$start-$k,$width,$width-$width/2,$angleStart,$angleStart + $angle,imagecolorallocate ($im, ($color[$i%16][1]-$color[$i%16][1]/4), ($color[$i%16][2]-$color[$i%16][2]/4), ($color[$i%16][3]-$color[$i%16][3]/4)),IMG_ARC_PIE);
                  else        
                      imagefilledarc($im,$width/2,$start-$k,$width,$width-$width/2,$angleStart,180,imagecolorallocate ($im, ($color[$i%16][1]-$color[$i%16][1]/4), ($color[$i%16][2]-$color[$i%16][2]/4), ($color[$i%16][3]-$color[$i%16][3]/4)),IMG_ARC_PIE);
          }   
    	  $angleStart = $angleStart + $angle;
      }
      if ($angleStart < 360)
      {  
          if ($angleStart < 180)         
              imagefilledarc($im,$width/2,$start-$k,$width,$width-$width/2,$angleStart,180,imagecolorallocate ($im, 221, 221, 221),IMG_ARC_PIE);
          imagefilledarc($im,$width/2,$start-10,$width,$width-$width/2,$angleStart,360,imagecolorallocate ($im, 221, 221, 221),IMG_ARC_PIE);
      }
  }
  
  if (isset($_GET["goo"]) )
  {
      imagefilledrectangle($im,$width-57,9,$width,$width-108,imagecolorallocate ($im, 255, 255, 255));
      imagerectangle($im,$width-57,9,$width,$width-108,imagecolorallocate ($im, 0, 0, 0));
      imagestring($im,1,$width-55+2,12,'GOOGLE-'.round($content [0]['value'],0).'%',imagecolorallocate ($im, $color[0][1], $color[0][2], $color[0][3])); 
      imagestring($im,1,$width-55+2,22,'BING-'.round($content [1]['value'],0).'%',imagecolorallocate ($im, $color[1][1], $color[1][2], $color[1][3])); 
      imagestring($im,1,$width-55+2,32,'YAHOO-'.round($content [2]['value'],0).'%',imagecolorallocate ($im, $color[2][1], $color[2][2], $color[2][3])); 
  }
  
  imagepng ($im);
?>
Return current item: D4WStatsLittle - Web Stats System