header("Content-type:image/png");//向浏览器输出文件头
$im=imagecreate(400, 400);
$yellow=imagecolorallocate($im, 255, 255, 180);
$blue=imagecolorallocate($im, 0,0,255);
$red=imagecolorallocate($im, 255,0,0);
for ($i = 1; $i < 360; $i++) {
$temp=150*sin(2*deg2rad($i));
$x=$temp*cos(deg2rad($i))+200;
$y=$temp*sin(deg2rad($i))+200;
imagesetpixel($im, $x, $y, $red);
$temp=150*cos(2*deg2rad($i));
$x=$temp*cos(deg2rad($i))+200;
$y=$temp*sin(deg2rad($i))+200;
imagesetpixel($im, $x, $y, $blue);
}
imagepng($im);//输出png图像
imagedestroy($im);//销毁图像资源,因其占用内存
//php绘制饼图
<?php
function pie2d($a) {
$im = imagecreate ( 420, 300 );
$back = imagecolorallocate ( $im, 255, 255, 200 );
$color = array (imagecolorallocate ( $im, 0, 0, 255 ), imagecolorallocate ( $im, 255, 0, 0 ), imagecolorallocate ( $im, 0, 255, 0 ), imagecolorallocate ( $im, 100, 100, 255 ), imagecolorallocate ( $im, 255, 0, 255 ), imagecolorallocate ( $im, 150, 0, 0 ), imagecolorallocate ( $im, 0, 0, 150 ), imagecolorallocate ( $im, 0, 150, 0 ), imagecolorallocate ( $im, 0, 0, 0 ), imagecolorallocate ( $im, 150, 150, 150 ) );
$value_a = array_values ( $a );
$all = array_sum ( $value_a );
$i = 0;
foreach ( $a as $key => $value ) {
$angle [] = $value / $all * 360;
$str = $key . ":" . round ( $value / $all * 100, 2 ) . "%";
imagestring ( $im, 5, 10, ($i * 20 + 10), $str, $color [$i] );
$i ++;
}
$s = 0;
$i = 0;
foreach ( $angle as $temp ) {
imagefilledarc ( $im, 285, 150, 240, 240, $s, $s + $temp, $color [$i], 4 );
$s += $temp;
$i ++;
}
header ( 'Content-type:image/png' );
imagepng ( $im );
imagedestroy ( $im );
}
$arr = array ("111" => 1, "222" => 4, "333" => 5, "444" => 6, "555" => 3, "666" => 5.4, "777" => 2.6, "888" => 3.2, "999" => 1.6, "000" => 6.3 );
$re = pie2d ( $arr );
分享到:
相关推荐
php饼图 jquery饼图 highcharts
饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图饼图...
一段关于用PHP制作饼图的代码,希望大家能看看,希望对大家有用
VML饼图,PHP版。 VML只有IE支持。 演示: http://www.liuyuanjun.com/test/chart0.php
python绘图代码饼图箱型图柱形图散点图点线图折线图绘图基础提取方式是百度网盘分享地址
flash饼图flash饼图flash饼图...
android 饼图 饼图 饼图 自定义饼图
VC饼图。VC,VC,饼图,饼图,VC饼图。VC,VC,饼图,饼图,VC饼图。VC,VC,饼图,饼图,VC饼图。VC,VC,饼图,饼图VC饼图。VC,VC,饼图,饼图VC饼图。VC,VC,饼图,饼图
echarts 3d饼图资源
ASP.NET 做的3D饼图。 可以2D、3D互转换。 具体代码自己可以看下,做适当的修改。 只是把代码贴出来了。
饼图,缓存-饼图,缓存-饼图,缓存-饼图
iOS 34-绘图饼图.zip
双层饼图
自定义双层嵌套饼图,里面一层饼图显示、外面罩着一层饼图显示,外加动画以及放大效果
flash饼图,php+flash饼图投票系统源代码
Android HelloChart饼图
3D 饼图 Pie jquery 点击有特效
简单饼图例子,总结了饼图的属性,事件。 适用于初学者。
项目中使用到的饼图控件,项目中需要实现以下需求 1.百分比显示在饼图相应的部分之上 2.饼图中间有一个圆形空洞,中间有文字 3.饼图每一部分之间有一个缝隙 4.点击饼图某一部分,该部分转动至最下方并弹出 5.点击...
MPAndroidChart饼图用法系列一 饼图各种属性的设置以及说明