我正在用 pChart 开发 php pie 聊天,它看起来不错。现在我想改变每个切片的颜色。可以改变颜色吗?
问问题
2639 次
3 回答
2
您正在寻找的功能是 setSliceColor() - http://wiki.pchart.net/doc.pie.setslicecolor.html
假设您已经从一些数据创建了一个新的饼图:
$PieChart = new pPie($myPicture,$MyData);
然后你可以像这样使用它:
$PieChart->setSliceColor(0, array("R" => 255, "G" => 0, "B" => 0));
$PieChart->setSliceColor(1, array("R" => 0, "G" => 255, "B" => 0));
etc...
于 2013-04-22T18:46:30.820 回答
1
对于 pChart(几乎所有版本),您只需使用以下命令:
...
$PieChart = new pPie($myPicture,$MyData);
$PieChart->setSliceColor(0,array("R"=>255,"G"=>128,"B"=>0));
$PieChart->setSliceColor(1,array("R"=>255,"G"=>255,"B"=>255));
$PieChart->setSliceColor(2,array("R"=>25,"G"=>128,"B"=>0));
$PieChart->setSliceColor(3,array("R"=>55,"G"=>255,"B"=>25));
...
只需添加更多 setSliceColor 即可在图表上获得更多切片
于 2015-10-06T14:43:49.373 回答
0
I solved this question just doing this:
/*
Example 10 - A 3D exploded pie graph
Version 1.27d pChart*/
$Test->loadColorPalette('ColorsDirectory/tones-9.txt',',');
$Test->drawPieGraph(
$DataSet->GetData(),
$DataSet->GetDataDescription(),
350,130,110,PIE_PERCENTAGE_LABEL,FALSE,50,20,5);
...
Call loadColorPalette just before calling drawPieGraph. It works this way.Good luck!
于 2013-09-19T16:35:09.347 回答