PHP object programming to implement a 3D pie chart .? Php public functions convert degrees to radians functiondeg2Arc ($ degrees) {return ($ degrees * (pi () 180.0);} RGBfunctiongetRGB ($ color) {$ R ($ color16) 0xff; $ G ($ color8) 0xff; // Public functions
// Converts degrees to radians
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 ));
}
// Obtain the values of the x and y points on an elliptical center (0, 0 ).
Function pie_point ($ deg, $ va, $ vb ){
$ X = cos (deg2Arc ($ deg) * $ va;
$ Y = sin (deg2Arc ($ deg) * $ vb;
Return (array ($ x, $ y ));
}
// 3D pie chart
Class Pie3d {
Var $ a; // The long half-axis of the ellipse.
Var $ B; // specifies the shorter half-axis of an ellipse.
Var $ DataArray; // data of each sector
Var $ ColorArray; // The color of each slice must be written in hexadecimal format, but 0x is not added before.
// Black for the edge and shadow
Function Pie3d ($ pa = 100, $ pb = 60, $ sData = "100,200,300,400,500", $ sColor = "ee00ff, dd0000, cccccc, ccff00, 00 ccff ")
{
$ This-> a = $ pa;
$ This-> B = $ pb;
$ This-> DataArray = split (",", $ sData );
$ This-> ColorArray = split (",", $ sColor );
}
Function setA ($ v ){
$ This-> a = $ v;
}
Function getA (){
Return $ this->;
}
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 // public function // converts the angle to Radian function deg2Arc ($ degrees) {return ($ degrees * (pi ()/180.0 ));} // RGB function getRGB ($ color) {$ R = ($ color16) 0xff; $ G = ($ color8) 0xff ;...