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: 4104
Status: resolved
Priority: 0/
Queue: GDGraph

People
Owner: bwarfield [...] cpan.org
Requestors: ajb [...] sanger.ac.uk
jjengel [...] us.ibm.com
Cc:
AdminCc:

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



Subject: GD::Graph::lines dies when y-axis values = "0.0"
GD::Graph::lines dies when y-axis values = "0.0". I have an array and every y-axis value is "0.0". It works when it is not "0.0" such as "0.1". Code: #!/usr/bin/perl use CGI; use GD; use GD::Graph::lines; my @data = ( ["Sun", "Mon"], [ "0.0","0.0" ]); # This doesn't work # [ "2.0","0.0" ]); # This works my $graph = new GD::Graph::lines(800,350); my $format = $graph->export_format; print CGI::header("image/$format"); # from use CGI? binmode STDOUT; print $graph->plot(\@data)->$format() or die $graph->error; Graph Version: # $Id: Graph.pm,v 1.53 2003/07/01 04:56:57 mgjv Exp $ # $Id: lines.pm,v 1.15 2003/02/10 22:12:41 mgjv Exp $ $ perl -V Summary of my perl5 (revision 5.0 version 6 subversion 0) configuration: Platform: osname=aix, osvers=5.0.0.0, archname=aix uname='aix shaq 1 5 006044854c00 ' config_args='-de' hint=recommended, useposix=true, d_sigaction=define usethreads=undef use5005threads=undef useithreads=undef usemultiplicity=undef useperlio=undef d_sfio=undef uselargefiles=define use64bitint=undef use64bitall=undef uselongdouble=undef usesocks=undef Compiler: cc='cc', optimize='-O', gccversion= cppflags='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384' ccflags ='-D_ALL_SOURCE -D_ANSI_C_SOURCE -D_POSIX_SOURCE -qmaxmem=16384 -q32 -D_LARGE_FILES -qlonglong' stdchar='unsigned char', d_stdstdio=define, usevfork=false intsize=4, longsize=4, ptrsize=4, doublesize=8 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=8 ivtype='long', ivsize=4, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, usemymalloc=n, prototype=define Linker and Libraries: ld='ld', ldflags ='-b32' libpth=/lib /usr/lib /usr/ccs/lib libs=-lbind -lnsl -lgdbm -ldbm -ldb -ldl -lld -lm -lC -lC_r -lc -lcrypt -lbsd -lPW -liconv libc=/lib/libc.a, so=a, useshrplib=false, libperl=libperl.a Dynamic Linking: dlsrc=dl_aix.xs, dlext=so, d_dlsymun=undef, ccdlflags=' -bE:/usr/opt/perl5/lib/5.6.0/aix/CORE/perl.exp' cccdlflags=' ', lddlflags='-bhalt:4 -bM:SRE -bI:$(PERL_INC)/perl.exp -bE:$(BASEEXT).exp -b noentry -lC -lc ' Characteristics of this binary (from libperl): Compile-time options: USE_LARGE_FILES Built under aix Compiled at Nov 22 2000 08:49:49 @INC: /usr/opt/perl5/lib/5.6.0/aix /usr/opt/perl5/lib/5.6.0 /usr/opt/perl5/lib/site_perl/5.6.0/aix /usr/opt/perl5/lib/site_perl/5.6.0 /usr/opt/perl5/lib/site_perl . Comment: I will find a work around in my program for this, so I will not need the fix, but someone else may need it. If this has already been corrected on newer versions. I apologize. Thanks. J.J. Engel
Subject: Croaks if all y values are 0.00
Date: Tue, 29 Jul 2008 16:22:00 +0100
To: bug-GDGraph [...] rt.cpan.org, Andy Brown <ajb [...] sanger.ac.uk>
From: Andrew Brown <ajb [...] sanger.ac.uk>
Hi, I have attempted to draw a lines and an area chart where all the y-values are 0.00. Instead of returning a blank graph, this seems to croak instead. Perl version: This is perl, v5.8.8 built for i686-linux GD;:Graph = 1.43 GD::Graph::Area = 1.16 GD::Graph::lines = 1.15 The error method returns: Read-only attribute 'width' not set, referer: http://intwebdev.sanger.ac.uk/cgi-bin/prodsoft/npg_qc/npg_qc/errors_by_cycle/?id_run=1022 No attribute 'legend', referer: http://intwebdev.sanger.ac.uk/cgi-bin/prodsoft/npg_qc/npg_qc/errors_by_cycle/?id_run=1022 Read-only attribute 'height' not set, referer: http://intwebdev.sanger.ac.uk/cgi-bin/prodsoft/npg_qc/npg_qc/errors_by_cycle/?id_run=1022 some example code: The data array that I am finally sending to plot id $data = [ [1,2,3,4,5,6,7,8,9,10], [0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00,0.00] ]; sub array_rotate { my ($self, $in) = @_; my $h = scalar @{$in}; $h or return []; my $w = scalar @{$in->[0]}; $w or return []; my $out = []; for my $j (0..$h-1) { for my $i (0..$w-1) { $out->[$i] ||= []; $out->[$i]->[$j] = $in->[$j]->[$i]; } } return $out; } sub plotter { my ($self, $data, $attrs, $type, $no_rotate) = @_; $type ||= 'lines'; $attrs ||= {}; $attrs->{legend} ||= []; my $width = $attrs->{width} || 800; my $height = $attrs->{height} || 640; if(!scalar @{$data}) { my $title = "No @{[$attrs->{title}||q()]} Data"; my $gd = GD::Image->new($width, $height); $gd->colorAllocate($COLOR_ALLOCATE,$COLOR_ALLOCATE,$COLOR_ALLOCATE); my $blk = $gd->colorAllocate(0,0,0); $gd->string(gdSmallFont, $width/2 - (length $title) * $THREE, $height/2 - $FOUR, $title, $blk); return $gd->png(); } my $cmap = $self->cmap(); my $gtype = "GD::Graph::$type"; my $graph = $gtype->new($width, $height); $graph->set( dclrs => [ map { GD::Graph::colour::add_colour(q(#).$cmap->hex_by_name($_)); } @{$self->colours()} ], fgclr => 'black', boxclr => 'white', accentclr => 'black', shadowclr => 'black', y_long_ticks => 1, %{$attrs}, ); if(scalar @{$attrs->{legend}}) { $graph->set_legend(@{$attrs->{legend}}); } if ($no_rotate) { return $graph->plot($data)->png(); } my $png; eval { $png = $graph->plot($self->array_rotate($data))->png(); } or do { carp 'going to die'; warn $graph->error(); }; return $png; } It would be great if you could take a look and see if this is a bug in the GD::Graph modules, as I only need to change one y value to 0.01 and it plots perfectly; Cheers Andy -- The Wellcome Trust Sanger Institute is operated by Genome Research Limited, a charity registered in England with number 1021457 and a company registered in England with number 2742969, whose registered office is 215 Euston Road, London, NW1 2BE.