Skip Menu |
 

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Chart-Clicker CPAN distribution.

Report information
The Basics
Id: 60603
Status: resolved
Priority: 0/
Queue: Chart-Clicker

People
Owner: Nobody in particular
Requestors: rod.taylor [...] gmail.com
Cc:
AdminCc:

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

Attachments
Chart_Clicker_Axis__scale_rendering.patch



Subject: Labels on Axis near beginning/end
Download (untitled) / with headers
text/plain 368b
Labels at the beginning and end of an axis had special rendering code to nudge the label into full view. Manually created labels which may be very close to the edge, but not exactly lower() or upper() did not receive the same treatment. Now they do. Instead of looking at the value it now looks at the position relative to the bounding box and nudges it accordingly.
Subject: Chart_Clicker_Axis__scale_rendering.patch
*** ./lib/Chart/Clicker/Axis.pm.orig 2010-08-21 19:47:14.000000000 -0400 --- ./lib/Chart/Clicker/Axis.pm 2010-08-21 20:22:05.000000000 -0400 *************** *** 335,367 **** my $iy = $height - $mark; my $label = $self->get_component($comp_count); if($self->is_left) { $label->origin->x($iox + $iwidth - $label->width); - if($val == $lower) { - # The first label (being at the bottom) needs to be - # skooched up a bit to fit. - $label->origin->y($iy - $label->height); - } elsif($val == $upper) { - # The last label (being at the top) can be positioned - # exactly at the mark. - $label->origin->y($iy); - } else { - $label->origin->y($iy - ($label->height / 2)); - } } else { - $label->origin->x($iox); - if($val == $lower) { - # The first label (being at the bottom) needs to be - # skooched up a bit to fit. - $label->origin->y($iy - $label->height); - } elsif($val == $upper) { - # The last label (being at the top) can be positioned - # exactly at the mark. - $label->origin->y($iy); - } else { - $label->origin->y($iy - ($label->height / 2)); - } } # Keep track of how many components we've actually grabbed, since # we could be skipping any that are in a skip range. --- 335,362 ---- my $iy = $height - $mark; my $label = $self->get_component($comp_count); + # Adjust text on the Y axis to fit when it is + # too close to the edges + my $standardYOrigin = $iy - ($label->height / 2); + #my $lowerYOrigin = $iy - $label->height; + my $lowerYOrigin = $ioy + $iheight - $label->height; + my $upperYOrigin = $ioy; + if($standardYOrigin >= $lowerYOrigin) { + # The first label (being at the bottom) needs to be + # skooched up a bit to fit. + $label->origin->y($lowerYOrigin); + } elsif($standardYOrigin <= $upperYOrigin) { + # The last label (being at the top) can be positioned + # exactly at the mark. + $label->origin->y($upperYOrigin); + } else { + $label->origin->y($standardYOrigin); + } + if($self->is_left) { $label->origin->x($iox + $iwidth - $label->width); } else { $label->origin->x($iox); } # Keep track of how many components we've actually grabbed, since # we could be skipping any that are in a skip range. *************** *** 400,423 **** } } ! if($self->is_top) { ! if($val == $lower) { ! $label->origin->x($ix); ! } elsif($val == $upper) { ! $label->origin->x($ix - $label->width); ! } else { ! $label->origin->x($ix - ($label->width / 1.8)); ! } $label->origin->y($ioy + $iheight - $label->height - $bump); } else { - if($val == $lower) { - $label->origin->x($ix); - } elsif($val == $upper) { - $label->origin->x($ix - $label->width); - } else { - $label->origin->x($ix - ($label->width / 1.8)); - } $label->origin->y($ioy + $bump); } # Keep track of how many components we've actually grabbed, since --- 395,416 ---- } } ! # Adjust the X-origin value to ensure it is within the graph ! # and does not get snipped when too close to the edge. ! my $standardXOrigin = $ix - ($label->width / 1.8); ! my $lowerXOrigin = $iox; ! my $upperXOrigin = $iox + $iwidth - $label->width; ! if($standardXOrigin <= $lowerXOrigin) { ! $label->origin->x($lowerXOrigin); ! } elsif($standardXOrigin >= $upperXOrigin) { ! $label->origin->x($upperXOrigin); ! } else { ! $label->origin->x($standardXOrigin); ! } ! if($self->is_top) { $label->origin->y($ioy + $iheight - $label->height - $bump); } else { $label->origin->y($ioy + $bump); } # Keep track of how many components we've actually grabbed, since
Applied to master on github. Hanging onto it for a bit, as you have some other pending patches.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.