Skip Menu |

This queue is for tickets about the Imager CPAN distribution.

Report information
The Basics
Id: 1985
Status: resolved
Worked: 10 min
Priority: 0/
Queue: Imager

People
Owner: ADDI [...] cpan.org
Requestors: etienne.goyer [...] linuxquebec.com
Cc:
AdminCc:

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



Subject: Imager::Plot : division by 0 in Axis.pm when all Y are equal
Hi, There is a division by 0 in Imager::Plot::Axis (line 130 and 449) when all Y are equal. This is pretty self-explantory if you read the code. For exemple, I worked around the code by overloading the make_yrange() function of Axis.pm : --- $graph->{'AXIS'}{'make_yrange'} = sub { $self = shift; my @bbox = $self->data_bbox(); if ($bbox[2] == $bbox[3]) { $min = $bbox[2] - 1; $max = $bbox[2] + 1; $self->{YgridNum} = 1; } else { $min = $bbox[2]; $max = $bbox[3]; } $self->{YRANGE} = [$min, $max]; } --- Thanks for your good code !
This has been fixed in CVS. See development webpage for information on how to access CVS.