如何去掉 Perl 的 GD::Graph 中的饼图轮廓?
我正在尝试使用 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;
I am trying to create a pie chart with no outline using GD::Graph. Frustratingly I can control the colour of the outline with this:
accentclr => 'black',
So I would expect that I could get rid of the outline completely by doing this:
accentclr => undef,
However, when I do this the outline does disappear but the rest of the pie chart does as well with only the labels remaining!
Here's a simplified version of my script:
#!/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;
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您无法将
accentclr
设置为undef
。来自
GD:Graph
文档:看来您最好的选择是将 Accentclr 值设置为与 boxclr 相同。
You cannot set
accentclr
toundef
.From the
GD:Graph
documentation:It seems that your best option would be to set the
accentclr
value to be the same asboxclr
.