您好,欢迎来到三六零分类信息网!老站,搜索引擎当天收录,欢迎发信息

请问jpgraph画饼图的有关问题

2026/2/19 9:53:45发布10次查看
请教jpgraph画饼图的问题
画饼图的代码如下:
//画饼状图
function drawpiegraph($width,$hight,$maintitle,$labels_x,$datay)
{
// create the pie graph. 
$graph = new piegraph($width,$hight);
$theme_class= new universaltheme;
$graph->settheme($theme_class);
// set a title for the plot
$graph->title->set($maintitle);
$graph->title->setfont(ff_simsun,fs_bold,20);
// create
$p1 = new pieplot3d($datay);
$graph->legend->setfont(ff_simsun,fs_bold);
$p1->setlegends($labels_x);
$graph->legend->pos(0.5,0.99,'center','bottom');
$graph->legend->setframeweight(0); //图例文字外框边框border设置为0
$graph->legend->setfillcolor('#ffffff'); //图例文字框内的填充颜色
$graph->legend->setshadow('#c8c8c8', 0);
$graph->add($p1);
$p1->showborder();
$p1->setcolor('black');
$p1->setslicecolors(array('#ee00ee','#2e8b57','#adff2f','#e5e5e5','#ff0000','#bf3eff','#8b2500','#4876ff','#eeee00','#00ff7f','#8b3e2f','#7a67ee'));
$p1->explodeslice(1);
$graph->stroke();
}
$maintitle=2011年业务量统计表;
$labels_x=array(一月,二月,三月,四月,五月,六月,七月,八月,九月,十月,十一月,十二月);
$datay=array(62,180,85,58,22,115,85,100,34,105,85,55);
drawpiegraph(800,650,$maintitle,$labels_x,$datay);
这个代码可以执行。可是显示出来的饼图的每一块上面没有显示是几月份的数据,看着比较累,有没有办法把月份写在饼图上相对应的每一个色块上面?请大虾指点。在线等。。。
------解决方案--------------------
$lbl = array(一月\n%.1f%%,二月\n%.1f%%,三月\n%.1f%%,
四月\n%.1f%%,五月\n%.1f%%,六月\n%.1f%%,七月\n%.1f%%,八月\n%.1f%%,九月\n%.1f%%,十月\n%.1f%%,十一月\n%.1f%%,十二月\n%.1f%%);
$p1->setlabels($lbl);
该用户其它信息

VIP推荐

免费发布信息,免费发布B2B信息网站平台 - 三六零分类信息网 沪ICP备09012988号-2
企业名录 Product