print "Content-type: image/png\n\n";
my @data = ([@xaxiss],[@yaxiss]);
use GD::Graph::bars;
use GD::Image;
$width=$xaxiss[0];
$height=$xaxiss[$#xaxiss];
#image -1 graph
my $mygraph = GD::Graph::bars->new(800,600);
# $mygraph->set_legend('Show gene details');
$mygraph->set(
title => "$pairs[0]",
x_label => "@xaxis",
x_labels_vertical => 90,
bar_width => 10,
bar_spacing => 1,
show_values => 1,
dclrs => ['lorange'] ,
axislabelclr => 'red',
# logo => 'bgcolor1.png', /corect on/
# logo_resize =>5.5,
transparent => 1,
shadowclr => 'gray',
shadow_depth =>3,
borderclr=>'green',
transparent => '0',
bgclr => 'lbrown',
boxclr => 'lbrown',
fgclr => 'blue',
cycle_clrs => '1',
) or warn $mygraph->error;
$mygraph->set_title_font(GD::gdGiantFont);
#$mygraph->set_legend_font(GD::gdGiantFont);
$mygraph->set_x_axis_font(GD::gdMediumBoldFont);
$mygraph->set_y_axis_font(GD::gdMediumBoldFont);
$mygraph->set_values_font(GD::gdSmallFont);
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
open(OUT,">/tmp/img1.png");
binmode OUT;
print OUT $myimage->png;
close OUT;
&head_1;
print $myimage->png;
#image-2 for heading
sub head_1{
sub InitColors {
my($im) = $_[0];
# Allocate colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
$green = $im->colorAllocate(0, 255, 0);
$brown = $im->colorAllocate(255, 0x99, 0);
$violet = $im->colorAllocate(255, 0, 255);
$yellow = $im->colorAllocate(255, 255, 0);
}
use GD;
# Create a new image
$im = new GD::Image(500, 80);
# Allocate some colors
&InitColors($im);
# Make the background transparent and interlaced
$im->transparent($white);
$im->interlaced('true');
$im->rectangle(0, 0, 500, 79, $white);
$x1 = 10;
$y1 = 20;
# Draw text in a TTF font
# $font = "/usr/X11R6/lib/X11/fonts/TTF/luxisri.ttf";
# $im->stringFT($red, $font, 15, 0, $x1, $y1, "A TTF font");
#$anotherfont = "/usr/share/fonts/default/TrueType/starbats.ttf";
$anotherfont = "/usr/share/fonts/ko/TrueType/hline.ttf";
$im->stringFT($black, $anotherfont, 30, 0, $x1, $y1 + 40, "Show gene details");
# Open a file for writing
open(PICTURE, ">/tmp/picture.png") or die("Cannot open file for writing");
# Make sure we are writing to a binary stream
#binmode PICTURE;
# Convert the image to PNG and print it to the file PICTURE
#print PICTURE $im->png;
print $im->png;
close PICTURE;
}
####
--new code--
print "Content-type: image/png\n\n";
sub InitColors {
my($im) = $_[0];
# Allocate colors
$white = $im->colorAllocate(255,255,255);
$black = $im->colorAllocate(0,0,0);
$red = $im->colorAllocate(255,0,0);
$blue = $im->colorAllocate(0,0,255);
$green = $im->colorAllocate(0, 255, 0);
$brown = $im->colorAllocate(255, 0x99, 0);
$violet = $im->colorAllocate(255, 0, 255);
$yellow = $im->colorAllocate(255, 255, 0);
}
my @data = ([@xaxiss],[@yaxiss]);
use GD::Graph::bars;
use GD::Image;
$width=$xaxiss[0];
$height=$xaxiss[$#xaxiss];
#image -1 graph
my $mygraph = GD::Graph::bars->new(800,600);
$mygraph->set_legend('Show gene details');
--changed portion--
$anotherfont = "/usr/share/fonts/ko/TrueType/hline.ttf";
$mygraph->set_stringFT('black', $anotherfont, 30,40, "Show gene details");
---change ends---
$mygraph->set(
title => "$pairs[0]",
x_label => "@xaxis",
x_labels_vertical => 90,
bar_width => 10,
bar_spacing => 1,
show_values => 1,
dclrs => ['lorange'] ,
axislabelclr => 'red',
# logo => 'bgcolor1.png', /corect on/
# logo_resize =>5.5,
transparent => 1,
shadowclr => 'gray',
shadow_depth =>3,
borderclr=>'green',
transparent => '0',
bgclr => 'lbrown',
boxclr => 'lbrown',
fgclr => 'blue',
cycle_clrs => '1',
) or warn $mygraph->error;
$mygraph->set_title_font(GD::gdGiantFont);
#$mygraph->set_legend_font(GD::gdGiantFont);
$mygraph->set_x_axis_font(GD::gdMediumBoldFont);
$mygraph->set_y_axis_font(GD::gdMediumBoldFont);
$mygraph->set_values_font(GD::gdSmallFont);
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
#open(OUT,">/tmp/img1.png");
#binmode OUT;
#print OUT $myimage->png;
#close OUT;
print $myimage->png;
####
--Error code--
http://10.188.12.27/cgi-bin/msgs/siva_graph/
graph1cgi.pl?A_thaliana&2&1&7473&NC_003070sNC_003071&6973s4403&