加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

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

发布时间:2020-12-16 06:16:18 所属栏目:大数据 来源:网络整理
导读:我正在尝试使用 GD::Graph创建一个没有轮廓的饼图.令人沮丧的是我可以控制轮廓的颜色: accentclr = 'black', 所以我希望通过这样做可以完全摆脱轮廓: accentclr = undef, 然而,当我这样做时,轮廓确实消失了,但饼图的其余部分也是如此,只剩下标签! 这是我
我正在尝试使用 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相同.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读