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

标签 perl graph gd

我正在尝试使用 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;

最佳答案

您不能设置 accentclrundef .

来自 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/

相关文章:

performance - perl 是编写高性能页面的最快方法吗?

perl - perl用 “==”比较字符串

java - JOpenChart x 轴上的日期

php - 如何使用 PHP GD 库向图像添加文本

PHP GD 无法正确渲染 unicode 字体

perl - 为什么我的 Moo 对象继承自非 Moo 类的某些模块被祝福到父包中?

algorithm - A* 搜索修改

algorithm - 一个有趣的迷宫

php - 在这种特殊情况下在 PHP 脚本之间传递值

perl - 如何使用 Perl 列出目录中的所有文件?