Hello everybody, This is my first mail at this group. I hope we will have good communication.
I have a trouble at graph display. I attached my graph. I want to leave
space between bargroups. I searched the forums and show the command:
bargroup_spacing
but it does not work. I dont know why. Here my code is:
sub face_range {
my $width = $q->param('width') || 1000;
my $height = $q->param('height') || 300;
my $id = $q->param('id') || 0;
my $item = $q->param('item') || 0;
my $sth_cache = $dbh->prepare
(qq(SELECT * FROM $T_CACHE
WHERE CacheID=? AND UserID=?
AND ItemID=?
));
# Read common graph data
$sth_cache->execute($CACHE{GRAPH_COMMON},$id,$item) || die 'SQL_ERROR';
my $common = $sth_cache->fetchrow_hashref || {};
my ($labels,$vendors) = split /\0/, $common->{Data};
my %vendors = split /,/, $vendors;
my @vendors = grep { /^\d+$/ } split /,/, $vendors;
# Read graph data
$sth_cache->execute($CACHE{GRAPH_FACE_RANGE},$id,$item) || die
'SQL_ERROR';
my $values = $sth_cache->fetchrow_hashref || {};
my %values = map { split /:/, $_ } split /\|/, $values->{Data};
my $min = 999999;
my $max = 0;
my @data = ();
push @data, [split /,/, $labels];
foreach my $vid (@vendors) {
my @index = split /,/, $values{$vid};
push @data, [...@index];
foreach (@index) {
$max = $_ if $_ > $max;
$min = $_ if $_ < $min;
}
}
my $data = GD::Graph::Data->new([...@data]);
use GD::Graph::bars3d;
my $graph = GD::Graph::bars3d->new($width,$height);
my $format = $graph->export_format;
$graph->set_legend_font(gdMediumBoldFont);
$graph->set_legend(map(&make_english($vendors{$_}),@vendors));
my @colors = split /,/, $RS{LINE_COLORS};
$graph->set
(y_max_value => 1.05 * $max,
y_min_value => 0.95 * $min,
y_number_format => "%04.2f",
y_tick_number => 10,
x_label_skip => 0,
y_label_skip => 0,
bar_spacing => 5,
bargroup_spacing => 5,
long_ticks => 1,
x_labels_vertical => 1,
transparent => 0,
line_width => 1,
fgclr => '#dddddd',
dclrs => \...@colors,
show_values => 1,
values_format => "%4.2f",
l_margin => 20,
b_margin => 10,
r_margin => 5,
t_margin => 10,
* bargroup_spacing => 4, (why does not work)
* legend_placement => 'RT',
);
print header("image/$format");
binmode STDOUT;
print $graph->plot($data)->$format;
}
I dont think it is because of perl version because ı use perl 5.0.
Thanks in advance.
Kadir Beyazlı
<<attachment: bar3d.gif>>
-- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected] http://learn.perl.org/
