Skip Menu |

This queue is for tickets about the GDGraph CPAN distribution.

Maintainer(s)' notes

There are plenty of good ideas of what people can do published here on the queue. Turning a patch from the tracker into a pull request is not one of them. In order to get maintainers' attention way more quickier, PR should have at least a sample included. We know it's hard to test images generating software, but it doesn't mean we can not test numbers produced by intermediate algorithms used to generate these images, so either a test or a sample.

Report information
The Basics
Id: 125661
Status: open
Priority: 0/
Queue: GDGraph

People
Owner: Nobody in particular
Requestors: islaind [...] yahoo.co.uk
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: (no value)



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;
Subject: Re: [rt.cpan.org #125661] bar graph shadow exists when value/height of bar is zero
Date: Thu, 28 Jun 2018 12:17:49 +1000
To: bug-GDGraph [...] rt.cpan.org
From: Martien Verbruggen <martien.verbruggen [...] gmail.com>
Hello, It's been quite a while since I've worked on GD::Graph: in fact I handed over maintenance to Benjamin Warfield years ago: I don't know whether he still actively works on it.. This is the first time I've seen this problem though. it is possible it has always existed and you're the first to notice it, but it's also possible something has changed in GD that has caused some rounding things. I remember a lot of rounding issues that were solved with hacks in the code. Either way, I am unlikely to find time to change the code, and to try to work this one out. If you're willing to try, I can always see whether I can accept a change and update the version. I did find a workaround/hack: If you set the fields that are 0 right now to undef, then GD::Graph won't even try to render the bars at all, and the shadow disappears. Sorry I can't be of more help right now. Martien On Sat, 23 Jun 2018 at 21:19 / via RT <bug-GDGraph@rt.cpan.org> wrote: Show quoted text
> Sat Jun 23 07:19:17 2018: Request 125661 was acted upon. > Transaction: Ticket created by islaind@yahoo.co.uk > Queue: GDGraph > Subject: bar graph shadow exists when value/height of bar is zero > Broken in: (no value) > Severity: (no value) > Owner: Nobody > Requestors: islaind@yahoo.co.uk > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > > > 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; >
Subject: Re: [rt.cpan.org #125661] bar graph shadow exists when value/height of bar is zero
Date: Thu, 28 Jun 2018 12:06:44 +0300
To: bug-GDGraph [...] rt.cpan.org
From: / <islaind [...] yahoo.co.uk>
Hello Martien, Thank your for your email. I will have a look at the code and if I find a remedy I will let you know. Nothing but free time for me right now. Many thanks for GD! Andreas Hadjiprocopis On 28/06/18 05:18, Martien Verbruggen via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > > Hello, > > It's been quite a while since I've worked on GD::Graph: in fact I handed > over maintenance to Benjamin Warfield years ago: I don't know whether he > still actively works on it.. > > This is the first time I've seen this problem though. it is possible it has > always existed and you're the first to notice it, but it's also possible > something has changed in GD that has caused some rounding things. I > remember a lot of rounding issues that were solved with hacks in the code. > > Either way, I am unlikely to find time to change the code, and to try to > work this one out. If you're willing to try, I can always see whether I can > accept a change and update the version. > > I did find a workaround/hack: If you set the fields that are 0 right now to > undef, then GD::Graph won't even try to render the bars at all, and the > shadow disappears. > > Sorry I can't be of more help right now. > > Martien > > On Sat, 23 Jun 2018 at 21:19 / via RT <bug-GDGraph@rt.cpan.org> wrote: >
>> Sat Jun 23 07:19:17 2018: Request 125661 was acted upon. >> Transaction: Ticket created by islaind@yahoo.co.uk >> Queue: GDGraph >> Subject: bar graph shadow exists when value/height of bar is zero >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: islaind@yahoo.co.uk >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > >> >> >> 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; >>
>
Subject: Re: [rt.cpan.org #125661] bar graph shadow exists when value/height of bar is zero
Date: Thu, 28 Jun 2018 16:54:33 +0300
To: bug-GDGraph [...] rt.cpan.org
From: / <islaind [...] yahoo.co.uk>
Hi again, I think I have found a couple of fixes: The file I am referring to is: GD/Graph/bars.pm (# $Id: bars.pm,v 1.26 2007/04/26 03:16:09 ben Exp $) which is what cpanm installs on my machine with perl v5.26.2 ** Fix #1 : quick and dirty The idea is that shadows should not be drawn if $value (the actual data value) is zero. In line 103 of said file (you can find that line if you search for '# XXX Clean this up') inside _draw_shadow() the line if ($value >= 0) should be changed to if ($value > 0) and its associated "else" should become elsif( $value < 0 ) alternatively insert a if( $value == 0 ){ return } in line 101 ---------------------- ** Fix #2 : elaborate but possibly more correct. The idea is that shadows should not be drawn unless the actual-data rectangle has height (or length in case of horizontal bars) of more than X. There is a little problem though: the shadows are drawn first and then the actual-data rectangle. in sub draw_data_set_v() which is responsible for the vertical-bars drawing, add this in line 273: if( abs($bottom-$t) < 1 ){ next } in this case $bottom and $t are the y1/y2 of the actual-data rectangle in sub draw_data_set_h() which is responsible for the horizontal-bars drawing, add this in line 157: if( abs($l-$r) < 1 ){ next } in this case $l and $r are the x1/x2 of the actual-data rectangle. To recap: what the above 2 conditionals do is to check whether the actual-data rectangle to be drawn later on will have so little height (width in the case of horizontal bars) that shadows should not be drawn. bw, Andreas On 28/06/18 05:18, Martien Verbruggen via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > > Hello, > > It's been quite a while since I've worked on GD::Graph: in fact I handed > over maintenance to Benjamin Warfield years ago: I don't know whether he > still actively works on it.. > > This is the first time I've seen this problem though. it is possible it has > always existed and you're the first to notice it, but it's also possible > something has changed in GD that has caused some rounding things. I > remember a lot of rounding issues that were solved with hacks in the code. > > Either way, I am unlikely to find time to change the code, and to try to > work this one out. If you're willing to try, I can always see whether I can > accept a change and update the version. > > I did find a workaround/hack: If you set the fields that are 0 right now to > undef, then GD::Graph won't even try to render the bars at all, and the > shadow disappears. > > Sorry I can't be of more help right now. > > Martien > > On Sat, 23 Jun 2018 at 21:19 / via RT <bug-GDGraph@rt.cpan.org> wrote: >
>> Sat Jun 23 07:19:17 2018: Request 125661 was acted upon. >> Transaction: Ticket created by islaind@yahoo.co.uk >> Queue: GDGraph >> Subject: bar graph shadow exists when value/height of bar is zero >> Broken in: (no value) >> Severity: (no value) >> Owner: Nobody >> Requestors: islaind@yahoo.co.uk >> Status: new >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > >> >> >> 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; >>
>
Subject: Re: [rt.cpan.org #125661] bar graph shadow exists when value/height of bar is zero
Date: Fri, 29 Jun 2018 09:32:29 +1000
To: bug-GDGraph [...] rt.cpan.org
From: Martien Verbruggen <martien.verbruggen [...] gmail.com>
Thanks. I'll try to have a look on the weekend. On Thu, 28 Jun 2018 at 23:54 / via RT <bug-GDGraph@rt.cpan.org> wrote: Show quoted text
> Queue: GDGraph > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > > Hi again, > > I think I have found a couple of fixes: > The file I am referring to is: GD/Graph/bars.pm (# $Id: bars.pm,v 1.26 > 2007/04/26 03:16:09 ben Exp $) which is what cpanm installs on my > machine with perl v5.26.2 > > ** Fix #1 : quick and dirty > The idea is that shadows should not be drawn if $value (the actual data > value) is zero. > In line 103 of said file (you can find that line if you search for '# > XXX Clean this up') inside _draw_shadow() > > the line > if ($value >= 0) > > should be changed to > > if ($value > 0) > > and its associated "else" should become > > elsif( $value < 0 ) > > alternatively insert a > if( $value == 0 ){ return } > in line 101 > ---------------------- > > ** Fix #2 : elaborate but possibly more correct. > The idea is that shadows should not be drawn unless the actual-data > rectangle has height (or length in case of horizontal bars) of more than > X. There is a little problem though: the shadows are drawn first and > then the actual-data rectangle. > > in sub draw_data_set_v() which is responsible for the vertical-bars > drawing, add this in line 273: > > if( abs($bottom-$t) < 1 ){ next } > > in this case $bottom and $t are the y1/y2 of the actual-data rectangle > > in sub draw_data_set_h() which is responsible for the horizontal-bars > drawing, add this in line 157: > > if( abs($l-$r) < 1 ){ next } > > in this case $l and $r are the x1/x2 of the actual-data rectangle. > > To recap: what the above 2 conditionals do is to check whether the > actual-data rectangle to be drawn later on will have so little height > (width in the case of horizontal bars) that shadows should not be drawn. > > bw, > > Andreas > > > On 28/06/18 05:18, Martien Verbruggen via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > > > > Hello, > > > > It's been quite a while since I've worked on GD::Graph: in fact I handed > > over maintenance to Benjamin Warfield years ago: I don't know whether he > > still actively works on it.. > > > > This is the first time I've seen this problem though. it is possible it
> has
> > always existed and you're the first to notice it, but it's also possible > > something has changed in GD that has caused some rounding things. I > > remember a lot of rounding issues that were solved with hacks in the
> code.
> > > > Either way, I am unlikely to find time to change the code, and to try to > > work this one out. If you're willing to try, I can always see whether I
> can
> > accept a change and update the version. > > > > I did find a workaround/hack: If you set the fields that are 0 right now
> to
> > undef, then GD::Graph won't even try to render the bars at all, and the > > shadow disappears. > > > > Sorry I can't be of more help right now. > > > > Martien > > > > On Sat, 23 Jun 2018 at 21:19 / via RT <bug-GDGraph@rt.cpan.org> wrote: > >
> >> Sat Jun 23 07:19:17 2018: Request 125661 was acted upon. > >> Transaction: Ticket created by islaind@yahoo.co.uk > >> Queue: GDGraph > >> Subject: bar graph shadow exists when value/height of bar is zero > >> Broken in: (no value) > >> Severity: (no value) > >> Owner: Nobody > >> Requestors: islaind@yahoo.co.uk > >> Status: new > >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=125661 > > >> > >> > >> 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; > >>
> >
>