Subject: | bar graph shadow exists when value/height of bar is zero |
Date: | Sat, 23 Jun 2018 14:18:51 +0300 |
To: | bug-GDGraph [...] rt.cpan.org |
From: | / <islaind [...] yahoo.co.uk> |
Hi there,
first of all, many thanks for providing GD::Graph as free software.
the problem:
I don't know if this is a bug or a feature but when the data for a
particular bar is zero, its height is zero. But still a shadow exists
rendered on the horizontal axis. This shadow may lead a user to think
that there is some small value in that bar when in fact there is none.
It's just a shadow! Especially accute when shadow color and bar color
are not that different colors.
reproduce:
You will notice in the output of the following short script that 1st,
3rd and 4th bars have values of zero, i.e. zero heights but the shadow
still drops onto the vertical axis causing confusion (to me at least).
bw,
bliako
test script:
use strict;
use warnings;
use GD::Graph::bars;
my $gd = GD::Graph::bars->new();
$gd->set(
bgclr => 'white',
fgclor => 'yellow',
dclrs => [ qw(red pink blue cyan) ],
shadow_depth => 1,
bar_spacing => 3,
transparent => 0,
show_values => 1,
);
my $data = GD::Graph::Data->new([
["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
[ 0, 2, 0, 0, 3, 1.5, 1, 3, 4],
]) or die GD::Graph::Data->error;
$gd->plot($data) or die $gd->error;
my $file = 'bars.png';
open(my $out, '>', $file) or die "Cannot open '$file' for write: $!";
binmode $out;
print $out $gd->gd->png;
close $out;