程序4-3 //假设利用文件count.txt保存计数值 <? /*检查count.txt文件是否存在,如果不存在则新建一个文件,并写入"000001",即假设最大计数为6位数*/ if(!file_exists("count.txt")){ //count.txt文件不存在 $fp=fopen("count.txt","w"); fwrite($fp,"000001"); $count="000001"; fclose($fp); } else{ //读取网页被浏览的次数值 $fp=fopen("count.txt","r"); $count=fread($fp,6); //----------------------------- $count+=1; //----------------------------- fclose($fp); //对变量$count的值进行格式化 switch(strlen($count)){ case 1: $count="00000".$count; break; case 2: $count="0000".$count; break; case 3: $count="000".$count; break; case 4: $count="00".$count; break; case 5: $count="0".$count; break; } //保存网页被浏览的次数值 $fp=fopen("count.txt","w"); fwrite($fp,$count); fclose($fp); } ?> 程序4-4 <? //从数据表中读取网页被浏览的次数值 $cn=mysql_connect("localhost","root","*****"); mysql_select_db("visit_log",$cn); $sql="select * from visit_count"; $result=mysql_query($sql,$cn); $record=mysql_fetch_array($result); //对网页被浏览的次数值加1,并保存到数据表中 if(empty($visited)){ $count=$record["count"]+1; $sql="update visit_counter set count=$count"; $result=mysql_query($sql,$cn); } mysql_close($cn); switch(strlen($count)){ case 1: $count="00000".$count; break; case 2: $count="0000".$count; break; case 3: $count="000".$count; break; case 4: $count="00".$count; break; case 5: $count="0".$count; break; } ?> 程序4-5 <?php Header("Content-type: image/jpeg"); $im = ImageCreate(45,16); //创建图像 $white = ImageColorAllocate($im,255,255,255); //定义字体颜色 $black = ImageColorAllocate($im,0,0,0); imagefill($im,1,1,$black);//对指定区域着色 ImageString($im,5,0,0,sprintf("%05d",$count),$white); //输出访问数 imageJpeg($im); //显示图形 imagedestroy($im); ?> 程序4-6 <?php //将数字转化为字符串 $strcount = strval($count); $strcount = chop($count); //将数字转化为图形 $countlen = strlen($strcount); $strhtml = ""; for($I = 0 ; $I < $countlen; $s++){ $strhtml = $strhtml. "<img src = ""; $strhtml = $strhtml.$strcount[$I]; $strhtml = $strhtml. ".gif">"; } ?> 程序4-7 <?php Header("Content-type:image/gif"); function display($file){ $fp=fopen($file,"rw"); $num=fgets($fp,6); $num=$num+1; exec("echo "$num">$file"); fclose($fp); $n=6-strlen($num); $out=imagecreate(96,20);// 建立新图 $im=imagecreatefromgif("0.gif"); //取出GIF图形 for($i=0;$i<$n;$i++) imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); //复制新图并调整大小 for($j=0;$j<strlen($num);$j++) switch(substr($num,$j,1)){ case "1": $im=imagecreatefromgif("1.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "2": $im=imagecreatefromgif("2.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "3": $im=imagecreatefromgif("3.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "4": $im=imagecreatefromgif("4.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "5": $im=imagecreatefromgif("5.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "6": $im=imagecreatefromgif("6.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "7": $im=imagecreatefromgif("7.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "8": $im=imagecreatefromgif("8.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "9": $im=imagecreatefromgif("9.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; case "0": $im=imagecreatefromgif("0.gif"); imagecopyresized($out,$im,$i*16,0,0,0,16,20,16,20); $i++; ImageDestroy($im); break; } imageGif($out); ImageDestroy($out); } $file="/tmp/count"; if(!file_exists($file)) exec("echo "0">$file"); display($file); ?> 程序4-8 文件名为:count.php <? //计数文件目录 $recdir="rec/"; //计数文件扩展名 $rfile=".txt"; if ($len=="") //位数 $int_width=6; else $int_width=$len; //定义单个数字宽度 $count_width=8; //定义单个数字高度 $count_height=16; //定义生成与数字0~9相对应的图形的数据 $bitmap =array( "0xff", "0xff", "0xff", "0xc3", "0x99", "0x99", "0x99", "0x99", /* rows 1-8 of 0 */ "0x99", "0x99", "0x99", "0x99", "0xc3", "0xff", "0xff", "0xff", /* rows 9-16 of 0 */ "0xff", "0xff", "0xff", "0xcf", "0xc7", "0xcf", "0xcf", "0xcf", /* rows 1-8 of 1 */ "0xcf", "0xcf", "0xcf", "0xcf", "0xcf", "0xff", "0xff", "0xff", /* rows 9-16 of 1 */ "0xff", "0xff", "0xff", "0xc3", "0x99", "0x9f", "0x9f", "0xcf", /* rows 1-8 of 2 */ "0xe7", "0xf3", "0xf9", "0xf9", "0x81", "0xff", "0xff", "0xff", /* rows 9-16 of 2 */ "0xff", "0xff", "0xff", "0xc3", "0x99", "0x9f", "0x9f", "0xc7", /* rows 1-8 of 3 */ "0x9f", "0x9f", "0x9f", "0x99", "0xc3", "0xff", "0xff", "0xff", /* rows 9-16 of 3 */ "0xff", "0xff", "0xff", "0xcf", "0xcf", "0xc7", "0xc7", "0xcb", /* rows 1-8 of 4 */ "0xcb", "0xcd", "0x81", "0xcf", "0x87", "0xff", "0xff", "0xff", /* rows 9-16 of 4 */ "0xff", "0xff", "0xff", "0x81", "0xf9", "0xf9", "0xf9", "0xc1", /* rows 1-8 of 5 */ "0x9f", "0x9f", "0x9f", "0x99", "0xc3", "0xff", "0xff", "0xff", /* rows 9-16 of 5 */ "0xff", "0xff", "0xff", "0xc7", "0xf3", "0xf9", "0xf9", "0xc1", /* rows 1-8 of 6 */ "0x99", "0x99", "0x99", "0x99", "0xc3", "0xff", "0xff", "0xff", /* rows 9-16 of 6 */ "0xff", "0xff", "0xff", "0x81", "0x99", "0x9f", "0x9f", "0xcf", /* rows 1-8 of 7 */ "0xcf", "0xe7", "0xe7", "0xf3", "0xf3", "0xff", "0xff", "0xff", /* rows 9-16 of 7 */ "0xff", "0xff", "0xff", "0xc3", "0x99", "0x99", "0x99", "0xc3", /* rows 1-8 of 8 */ "0x99", "0x99", "0x99", "0x99", "0xc3", "0xff", "0xff", "0xff", /* rows 9-16 of 8 */ "0xff", "0xff", "0xff", "0xc3", "0x99", "0x99", "0x99", "0x99", /* rows 1-8 of 9 */ "0x83", "0x9f", "0x9f", "0xcf", "0xe3", "0xff", "0xff", "0xff" /* rows 9-16 of 9 */ ); if ($id) { if (file_exists("$recdir$id$rfile")) { $file=fopen("$recdir$id$rfile","r"); $num=fread($file,$int_width); fclose($file); $counter = $num+1; $plusfile=fopen("$recdir$id$rfile","w"); fwrite($plusfile,$counter); fclose($plusfile); } else { $num=0; } for ($i = 0; $i < $int_width; ++$i) { $j = $num % 10; $count[$int_width - 1 - $i] = $j; $num /= 10; } printf("#define counter_width %drn",$count_width * $int_width); printf("#define counter_height %drn",$count_height); printf("static unsigned char counter_bits[] = {rn"); for ($i = 0; $i < $count_height; ++$i) { for ($j = 0; $j < $int_width; ++$j) { printf("%s", $bitmap[($count[$j] * $count_height) + $i]); if (( $i < $count_height - 1) || ($j < $int_width - 1)) printf(", "); } } printf("rn};"); } ?> 程序4-9 <? //进行计数 session_start(); if (session_is_registered(count)==false){ while(($fp=fopen("counter.txt","r+"))==false); while(flock($fp,3)==false); $count=fgets($fp,255); $count+=1; fseek($fp,0); fputs($fp,$count); fclose($fp); session_register(count); } $len=strlen($count); for($i=1;$i<=6-$len;$i++) { $imagpath="<img src=temp/0.gif>" ; //TEMP为图像文件夹,图像文件名需为0.GIF…… 9.GIF } //显示计数值 for($i=1;$i<=$len;$i++) { $imagpath.="<img src= temp/".substr($count,$i-1,1).".gif>"; } print"你是第".$imagpath."位来客"; ?> 程序4-10 文件名为:count.php <? Header("Content-type:image/png"); $img=ImageCreate(60,20); $link=mysql_pconnect("localhost"); mysql_select_db("liarrn",$link); mysql_query("update counter set count=count+1",$link); $str="select count from counter"; $result=mysql_query($str,$link); list($counter)=mysql_fetch_row($result); $counter=sprintf("%05d",$counter); for($i=0;$i<5;$i++){ $tmpstr="/bookfigures/".substr($counter,$i,1).".png"; $tmpimg=Imagecreatefrompng($tmpstr); ImageCopyResized($img,$tmpimg,$i*12,0,0,0,12,20,12,20); ImageDestroy($tmpimg); } ImagePng($img); ImageDestroy($img); ?> 程序4-11 <?php // 发送头信息和创建初始的空白画布 Header( "Content-type: image/gif"); $image = imagecreate(200,200); // 分配一些颜色 $red = ImageColorAllocate($image,255,0,0); $blue = ImageColorAllocate($image,0,0,255); $white = ImageColorAllocate($image,255,255,255); $grey = ImageColorAllocate($image,200,200,200); // 创建一个初始的灰色矩形用于绘图 ImageFilledRectangle($image,0,0,200,200,$grey); // 连接MySQL服务器并选择数据库 $connect = mysql_connect("","root",""); mysql_select_db("graphing",$connect); // 找到结果集中的最大数值 $sql = "SELECT MAX(g_num) FROM sales"; $maxResult = mysql_query($sql,$connect); $max = mysql_result($maxResult,0,0); // 得到公司A的结果集 $sql = "SELECT g_num FROM sales WHERE g_team='公司A ' ORDER BY g_month"; $salesResult = mysql_query($sql,$connect); // 找到返回多少列,就是'columns'的数值 $columns = mysql_num_rows($salesResult); // $x每次增加多少量? $xincrement = bcdiv(200,$columns-1,0); $x=0; // $i 将记录行的数值 $i=0; // 在所有的数据行中循环 while($salesRow=mysql_fetch_array($salesResult)) { // 像上面所讨论地计算y的坐标值 $y = bcmul(bcdiv($salesRow[0],$max,2),200,2); // 在$points数组中增加值 $points[$i][0] = $x; $points[$i][1] = $y; // 增加$x的值用$xincrement $x+=$xincrement; // 增加 $i $i++; } // 现在在$points数组中循环,此时$i小于$columns-1 for($i=0;$i<$columns-1;$i++) { /*传递 $points[$I][0] 作为第一个x坐标,$points[$I][1] 为第一个y坐标 $points[$I+1][0], $points[$I+1][1] 将是下一个x,y坐标集*/ ImageLine($image,$points[$i][0],$points[$i][1],$points[$i+1][0], $points[$i+1][1],$red); } // 输出GIF给浏览器并且释放内存 ImageGIF($image); ImageDestroy($image); ?> 程序4-12 <?php $sql = "SELECT g_num FROM sales WHERE g_team='Atlanta' ORDER BY g_month"; $salesResult = mysql_query($sql,$connect); $columns = mysql_num_rows($salesResult); $xincrement = bcdiv(200,$columns-1,0); $x=0; $i=0; while($salesRow=mysql_fetch_array($salesResult)) { $y = bcmul(bcdiv($salesRow[0],$max,2),200,2); $points[$i][0] = $x; $points[$i][1] = $y; $x+=$xincrement; $i++; } for($i=0;$i<$columns-1;$i++) { ImageLine($image,$points[$i][0],200-$points[$i][1],$points[$i+1][0],200-$points[$i+1][1],$blue); } ?> 程序4-13 <? function image($graphdata,$label,$data,$graphwidth,$graphheight,$graphscale,$graphfont, $bg,$text,$grid,$bar,$bz) { header("Content-type:image/gif"); //创建空白图形 $image=imagecreate($graphwidth+50,$graphheight+50); //分配颜色 $bgcolor= imagecolorallocate ($image ,$bg[0],$bg[1],$bg[2]); $textcolor= imagecolorallocate ($image ,$text[0],$text[1],$text[2]); $gridcolor=imagecolorallocate ($image ,$grid[0],$grid[1],$grid[2]); $barcolor=imagecolorallocate ($image ,$bar[0],$bar[1],$bar[2]); $gridabelwidth=imagefontwidth($graphfont)*3+1; $gridableheight= imagefontheight ($graphfont); //绘制直线 imageline($image,$gridlabelwidth,0,$gridlabelwidth,$graphheight-1,$gridcolor); imageline($image,0,$graphheight-1,$graphwidth-1,$graphheight-1,$gridcolor); for($i=0;$i<$graphheight;$i+=$graphheight/10) { imagedashedline ($image,0,$i,$graphwidth-1,$i,$gridcolor); imagestring($image,$graphfont,0,$i,round(($graphheight-$i)/$graphscale),$textcolor); } $barwidth=(($graphwidth-$gridlabelwidth)/count($graphdata))-30; for($i=0;$i { $bartopx=$gridlabelwidth+(($i+1)*20)+($i*$barwidth); $barbottomx=$bartopx+$barwidth; $barbottomy=$graphheight-1; $bartopy=$barbottomy-($graphdata[$i]*$graphscale); //图形着色 imagefilledrectangle($image,$bartopx,$bartopy,$barbottomx,$barbottomy,$barcolor); $labelx1=$bartopx; $labely1=$bartopy-15; $labelx2=$bartopx; $labely2=$graphheight; //输出字符串 imagestring($image,$graphfont,$labelx1,$labely1,"$graphdata[$i]"."%",$textcolor); imagestring($image,$graphfont,$labelx2,$labely2,"$label[$i]",$textcolor); imagestringup ($image,$graphfont,$labelx1+10,$labely1-$gridableheight, "$data[$i]",$textcolor); } imagestring($image,$graphfont,1,$graphheight+30,$bz,$textcolor); imagegif ($image); } ?> 程序4-14 <?php //把角度转换为弧度 function radians ($degrees) { return($degrees * (pi()/180.0)); } //取得在圆心为(0,0)的圆上x,y点的值 function circle_point($degrees, $diameter) { $x = cos(radians($degrees)) * ($diameter/2); $y = sin(radians($degrees)) * ($diameter/2); return (array($x, $y)); } //填充图表的参数 $ChartDiameter = 200; //图表直径 $ChartFont = 2; //图表字体 $ChartFontHeight = imagefontheight($ChartFont);//图表字体的大小 $ChartData = array( "75","45");//用于生成图表的数据,可通过数据库来取得来确定 $ChartLabel = array("yes", "no"); //数据对应的名称 //确定图形的大小 $ChartWidth = $ChartDiameter + 20; $ChartHeight = $ChartDiameter + 20 + (($ChartFontHeight + 2) * count($ChartData)); //确定统计的总数 for($index = 0; $index < count($ChartData); $index++) { $ChartTotal += $ChartData[$index]; } $ChartCenterX = $ChartDiameter/2 + 10; $ChartCenterY = $ChartDiameter/2 + 10; //创建空白图形 $image = imagecreate($ChartWidth, $ChartHeight); //分配颜色 $colorBody = imagecolorallocate($image, 0xFF, 0xFF, 0xFF); $colorBorder = imagecolorallocate($image, 0x00, 0x00, 0x00); $colorText = imagecolorallocate($image, 0x00, 0x00, 0x00); $colorSlice[] = imagecolorallocate($image, 0xFF, 0x00, 0x00); $colorSlice[] = imagecolorallocate($image, 0x00, 0xFF, 0x00); //图形着色 imagefill($image, 0, 0, $colorBody); //绘制扇形 $Degrees = 0; for($index = 0; $index < count($ChartData); $index++) { $StartDegrees = round($Degrees); $Degrees += (($ChartData[$index]/$ChartTotal)*360); $EndDegrees = round($Degrees); $CurrentColor = $colorSlice[$index%(count($colorSlice))]; //绘制圆弧 imagearc($image,$ChartCenterX,$ChartCenterY,$ChartDiameter, $ChartDiameter,$StartDegrees,$EndDegrees, $CurrentColor); //画直线 list($ArcX, $ArcY) = circle_point($StartDegrees, $ChartDiameter); imageline($image,$ChartCenterX,$ChartCenterY,floor($ChartCenterX + $ArcX), floor($ChartCenterY + $ArcY),$CurrentColor); list($ArcX, $ArcY) = circle_point($EndDegrees, $ChartDiameter); imageline($image,$ChartCenterX,$ChartCenterY,ceil($ChartCenterX + $ArcX), ceil($ChartCenterY + $ArcY),$CurrentColor); //填充扇形 $MidPoint = round((($EndDegrees - $StartDegrees)/2) + $StartDegrees); list($ArcX, $ArcY) = circle_point($MidPoint, $ChartDiameter/2); imagefilltoborder($image,floor($ChartCenterX + $ArcX), floor($ChartCenterY + $ArcY), $CurrentColor,$CurrentColor); } //画边框 imagearc($image, $ChartCenterX, $ChartCenterY, $ChartDiameter, $ChartDiameter, 0, 180, $colorBorder); imagearc($image, $ChartCenterX, $ChartCenterY, $ChartDiameter, $ChartDiameter, 180, 360, $colorBorder); imagearc($image, $ChartCenterX, $ChartCenterY, $ChartDiameter+7, $ChartDiameter+7, 0, 180, $colorBorder); imagearc($image, $ChartCenterX, $ChartCenterY, $ChartDiameter+7, $ChartDiameter+7, 180, 360, $colorBorder); imagefilltoborder($image, floor($ChartCenterX + ($ChartDiameter/2) + 2), $ChartCenterY, $colorBorder, $colorBorder); for($index = 0; $index < count($ChartData); $index++) { $CurrentColor = $colorSlice[$index%(count($colorSlice))]; $LineY = $ChartDiameter + 20 + ($index*($ChartFontHeight+2)); //绘制矩形框 imagerectangle($image, 10, $LineY, 10 + $ChartFontHeight, $LineY+$ChartFontHeight, $colorBorder); imagefilltoborder($image, 12, $LineY + 2, $colorBorder, $CurrentColor); //输出字符串 imagestring($image, $ChartFont, 20 + $ChartFontHeight, $LineY, "$ChartLabel[$index]: $ChartData[$index]", $colorText); } /*至此,已经生成了一幅图像,但需要把它发到浏览器上,即要将标头发送给浏览器,以便让它知道这是一个GIF文件。*/ header("Content-type: image/gif"); //输出生成的图片 imagegif($image); ?> 程序4-15 <?php //公用函数 //把角度转换为弧度 function deg2Arc($degrees) { return($degrees * (pi()/180.0)); } //RGB function getRGB($color){ $R=($color>>16) & 0xff; $G=($color>>8) & 0xff; $B=($color) & 0xff; return (array($R,$G,$B)); } // 取得在椭圆心为(0,0)的椭圆上 x, y点的值 function pie_point($deg,$va,$vb){ $x= cos(deg2Arc($deg)) * $va; $y= sin(deg2Arc($deg)) * $vb; return (array($x, $y)); } //3D饼图类 class Pie3d{ //声明成员变量 var $a; //椭圆长半轴 var $b; //椭圆短半轴 var $DataArray; //每个扇形的数据 var $ColorArray; //每个扇形的颜色要求按照十六进制书写,但前面不加0x,边缘及阴影为黑色 //定义构造函数 function Pie3d($pa=100,$pb=60,$sData="100,200,300,400,500", $sColor="ee00ff,dd0000,cccccc,ccff00,00ccff") { $this->a=$pa; $this->b=$pb; $this->DataArray=split(",",$sData); $this->ColorArray=split(",",$sColor); } //定义方法 function setA($v){ $this->a=$v; } function getA(){ return $this->a; } function setB($v){ $this->b=$v; } function getB(){ return $this->b; } function setDataArray($v){ $this->DataArray=split(",",$v); } function getDataArray($v){ return $this->DataArray; } function setColorArray($v){ $this->ColorArray=split(",",$v); } function getColorArray(){ return $this->ColorArray; } function DrawPie(){ $image=imagecreate($this->a*2+40,$this->b*2+40); $PieCenterX=$this->a+10; $PieCenterY=$this->b+10; $DoubleA=$this->a*2; $DoubleB=$this->b*2; list($R,$G,$B)=getRGB(0); $colorBorder=imagecolorallocate($image,$R,$G,$B); $DataNumber=count($this->DataArray); //算出数据和 for($i=0;$i<$DataNumber;$i++) $DataTotal+=$this->DataArray[$i]; //填充背景 imagefill($image, 0, 0, imagecolorallocate($image, 0xFF, 0xFF, 0xFF)); //画每一个扇形 $Degrees = 0; for($i = 0; $i < $DataNumber; $i++){ $StartDegrees = round($Degrees); $Degrees += (($this->DataArray[$i]/$DataTotal)*360); $EndDegrees = round($Degrees); $percent = number_format($this->DataArray[$i]/$DataTotal*100, 1); list($R,$G,$B)=getRGB(hexdec($this->ColorArray[$i])); $CurrentColor=imagecolorallocate($image,$R,$G,$B); if ($R>60 and $R<256) $R=$R-60; if ($G>60 and $G<256) $G=$G-60; if ($B>60 and $B<256) $B=$B-60; $CurrentDarkColor=imagecolorallocate($image,$R,$G,$B); //画扇形弧 imagearc($image,$PieCenterX,$PieCenterY,$DoubleA,$DoubleB, $StartDegrees,$EndDegrees,$CurrentColor); //画直线 list($ArcX, $ArcY) = pie_point($StartDegrees , $this->a , $this->b); imageline($image,$PieCenterX,$PieCenterY,floor($PieCenterX + $ArcX), floor($PieCenterY + $ArcY),$CurrentColor); //画直线 list($ArcX, $ArcY) = pie_point($EndDegrees,$this->a , $this->b); imageline($image,$PieCenterX,$PieCenterY,ceil($PieCenterX + $ArcX), ceil($PieCenterY + $ArcY),$CurrentColor); //填充扇形 $MidPoint = round((($EndDegrees - $StartDegrees)/2) + $StartDegrees); list($ArcX, $ArcY) = Pie_point($MidPoint, $this->a*3/4 , $this->b*3/4); imagefilltoborder($image,floor($PieCenterX + $ArcX), floor($PieCenterY + $ArcY), $CurrentColor,$CurrentColor); imagestring($image,2,floor($PieCenterX + $ArcX-5), floor($PieCenterY + $ArcY-5),$percent."%",$colorBorder); //画阴影 if ($StartDegrees>=0 and $StartDegrees<=180){ if($EndDegrees<=180){ for($k = 1; $k < 15; $k++) imagearc($image,$PieCenterX, $PieCenterY+$k,$DoubleA, $DoubleB, $StartDegrees, $EndDegrees, $CurrentDarkColor); }else{ for($k = 1; $k < 15; $k++) imagearc($image,$PieCenterX, $PieCenterY+$k,$DoubleA, $DoubleB, $StartDegrees, 180, $CurrentDarkColor); } } } /*到此,已经可以产生一幅3D饼形图。下面的工作就是把它发到浏览器上,重要的一点是要将标头发给浏览器,让它知道这是一个GIF文件*/ //输出生成的图片 header("Content-type: image/gif"); imagegif($image); imagedestroy($image); }//End drawPie() }//End class //实现 $objp = new Pie3d(); $objp->DrawPie(); ?>