Skip Menu |

This queue is for tickets about the Chart CPAN distribution.

Report information
The Basics
Id: 18502
Status: open
Priority: 0/
Queue: Chart

People
Owner: Nobody in particular
Requestors: ntyni [...] iki.fi
Cc:
AdminCc:

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



Subject: 'y_min_ticks' and 'y_max_ticks' aren't honored when 'integer_ticks_only' is set
Hi, in Chart 2.4.1, when 'integer_ticks_only' is set, the settings for 'min_y_ticks' and 'max_y_ticks' don't take any effect. This can be seen eg. with the following script: -------- #! /usr/bin/perl -w use Chart::LinesPoints; @data=([2000..2200], [0..200]); $obj=Chart::LinesPoints->new (600,400); $obj->set ('max_y_ticks' => 6); $obj->set ('min_y_ticks' => 2); $obj->set ('integer_ticks_only' => 1); $obj->png ("foo.png",\@data); -------- You get 200 Y ticks (which are unreadable) disregarding the max_y_ticks of 6. If you remove integer_ticks_only, you get just 3 ticks. I'm attaching a patch that fixes this. In the case of max_y_ticks, if the result would go over that, the tick interval is increased. This will override 'skip_int_ticks', if needed. In the case of min_y_ticks, if the result is below that, first the tick interval is decreased (overriding 'skip_int_ticks', if needed). If that doesn't help, the range of the scale is increased by either increasing the maximum value or decreasing the minimum value. If both are fixed, there's nothing to be done. Please consider including the patch in a future release. For reference, this was originally reported by Bill Allombert as Debian bug #359943, http://bugs.debian.org/359943 . I have investigated this with Perl 5.8.8 on Debian GNU/Linux. Cheers, -- Niko Tyni (on behalf of the Debian Perl Group) ntyni@iki.fi
Subject: Chart-ticks-patch
Download Chart-ticks-patch
application/octet-stream 3.1k

Message body not shown because it is not plain text.

From: ntyni [...] iki.fi
On Sun Apr 02 16:06:19 2006, I wrote: Show quoted text
> in Chart 2.4.1, when 'integer_ticks_only' is set, the settings for > 'min_y_ticks' and 'max_y_ticks' don't take any effect.
Show quoted text
> I'm attaching a patch that fixes this.
Oops, forgot to mention that the patch also modifies the three tests whose output is changed because they use 'integer_ticks_only' but expect less ticks than the default 'min_y_ticks' value, 6. The output of any of the other tests is not affected. Cheers, -- Niko Tyni ntyni@iki.fi
From: ntyni [...] iki.fi
On Sun Apr 02 16:06:19 2006, guest wrote: Show quoted text
> in Chart 2.4.1, when 'integer_ticks_only' is set, the settings for > 'min_y_ticks' and 'max_y_ticks' don't take any effect.
Hi, after a few iterations (as can be seen at http://bugs.debian.org/359943 ), here's a better version of the patch. It uses the same logic for calculating the y-axis ticks for both values of 'integer_ticks_only'. The biggest special case left is now when a fixed tick interval is explicitly given via 'skip_int_ticks'. The patch also modifies Chart/HorizontalBars.pm, as the 'skip_int_ticks' property can't be initialized to 1 anymore to keep track of whether it was explicitly specified. I suppose the whole 'integer_ticks_only' logic should be changed in the same way in Chart/HorizontalBars.pm too, but didn't do that myself to keep the patch clearer. Again, some of the tests need modification to explicitly specify 'min_int_ticks', which otherwise defaults to 6. With these modifications, the only difference in tests output is with pareto_3.t, where one more tick is drawn now. This happens because the old code had different thresholds for suppressing the last tick in the different 'integer_ticks_only' cases. Please consider applying the patch. Cheers, -- Niko Tyni ntyni@iki.fi
Download Chart-ticks-patch.new
application/octet-stream 8.7k

Message body not shown because it is not plain text.