教程集 www.jiaochengji.com
教程集 >  脚本编程  >  php  >  正文 PHP对象编程实现3D饼图

PHP对象编程实现3D饼图

发布时间:2017-10-22   编辑:jiaochengji.com
教程集为您提供PHP对象编程实现3D饼图等资源,欢迎您收藏本站,我们将为您提供最新的PHP对象编程实现3D饼图资源
<?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);

您可能感兴趣的文章:
PHP对象编程实现3D饼图
php饼状图的绘制代码一例
php绘制饼状图的代码举例
js图表组件highcharts简介
photoshop设计可爱的巧克力字体制作教程
Illustrator简单制作3D立体文字效果教程
关于python matplotlib绘图使用详解
photoshop工业级电影调色让相机照片秒变银幕大片效果教程
java 百分比饼图的实现代码
Illustrator绘制3D楼层户型图效果实例教程

[关闭]
~ ~