图表列中的背景图像
我有绘制图表的 cgi 脚本。这是代码:
#!/usr/bin/perl -w
use CGI ':standard';
use GD::Graph::bars;
use strict;
my @data = (["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[23, 5, 2, 20, 11, 33, 7, 31, 77, 18, 65, 52]);
my $mygraph = GD::Graph::bars->new(500, 300);
$mygraph->set(
x_label => 'Month',
y_label => 'Number of Hits',
title => 'Number of Hits in Each Month in 2002',
dclrs => ['cyan']
) or warn $mygraph->error;
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
print "Content-type: image/png\n\n";
print $myimage->png;
所有列都是青色。那么...
您有什么想法如何将图像而不是颜色放置在列中吗?
我在网上搜索了相关信息,但没有找到类似的内容。 我想只使用 GD.pm,而不使用其他模块,例如 ImageMagick。
I have cgi-script that draws a graph. Here is the code:
#!/usr/bin/perl -w
use CGI ':standard';
use GD::Graph::bars;
use strict;
my @data = (["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[23, 5, 2, 20, 11, 33, 7, 31, 77, 18, 65, 52]);
my $mygraph = GD::Graph::bars->new(500, 300);
$mygraph->set(
x_label => 'Month',
y_label => 'Number of Hits',
title => 'Number of Hits in Each Month in 2002',
dclrs => ['cyan']
) or warn $mygraph->error;
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
print "Content-type: image/png\n\n";
print $myimage->png;
All the columns are cyan color. So...
Have you got any ideas how can I place image in columns instead of color?
I searched the web about it but nothing similar I couldn't find.
I would like to use only GD.pm without using additional modules such as ImageMagick.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我不知道。您可以通过指定徽标选项为整个图表提供背景图像。
但我认为你不能只将图像放入列中。
I don't know. You can have a background image for the entire graph by specifying the logo option.
But I don't think you can put an image in only the columns.