如何摆脱Perl的GD :: Graph中的饼图轮廓?

前端之家收集整理的这篇文章主要介绍了如何摆脱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;

解决方法

你不能将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 07001,except Boxclr,which can be undefined,in which case the Box will not be filled.

看来你最好的选择是将accentclr值设置为与Boxclr相同.

猜你在找的Perl相关文章