我正在尝试使用 GD::Graph 创建一个没有轮廓的饼图.令人沮丧的是,我可以通过以下方式控制轮廓的颜色:
accentclr => 'black',
所以我希望我可以通过这样做完全摆脱轮廓:
accentclr => undef,
但是,当我这样做时,轮廓确实消失了,但饼图的其余部分也一样,只剩下标签!
这是我的脚本的简化版本:
#!/usr/bin/env perl
use GD::Graph::pie;
# Data to be graphed: 1st array is labels, 2nd array is data
my @data = (
["1st","2nd","3rd","4th"],
[ 1, 3.5, 5, 6 ],
);
my $graph = GD::Graph::pie->new(400, 400);
$graph->set(
# accentclr => undef,
'3d' => 0,
) or die $graph->error;
my $gd = $graph->plot(\@data) or die $graph->error;
open(IMG, '>pie.png') or die $!;
binmode IMG;
print IMG $gd->png;
最佳答案
您不能设置 accentclr
至 undef
.
来自 GD:Graph
文档:
bgclr, fgclr, boxclr, accentclr, shadowclr
Drawing colours used for the chart: background, foreground (axes and grid), axis box fill colour, accents (bar, area and pie outlines), and shadow (currently only for bars).
All colours should have a valid value as described in "COLOURS", except boxclr, which can be undefined, in which case the box will not be filled.
似乎您最好的选择是设置
accentclr
值与 boxclr
相同.
关于perl - 如何摆脱 Perl 的 GD::Graph 中的饼图轮廓?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2920756/