您好,欢迎访问一九零五行业门户网

PHP对象编程实现3D饼图_PHP教程

>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);
http://www.bkjia.com/phpjc/631788.htmlwww.bkjia.comtruehttp://www.bkjia.com/phpjc/631788.htmltecharticle?php //公用函数 //把角度转换为弧度 function deg2arc($degrees) { return($degrees * (pi()/180.0)); } //rgb function getrgb($color){ $r=($color16) 0xff; $g=($color8) 0xff;...
其它类似信息

推荐信息