Permalink
Browse files

oops wrong cut-n-paste.

  • Loading branch information...
1 parent 594ca48 commit 94211b5c5e975a4112d1e9d9425d0d5d67bb4f72 @barbie committed Jan 28, 2012
Showing with 14 additions and 16 deletions.
  1. +14 −16 lib/CPAN/Testers/WWW/Statistics/Graphs.pm
@@ -341,27 +341,25 @@ sub _set_max {
}
sub _set_range {
- my $max = shift;
- my $lmt = 10;
-
- return $lmt if($max <= $lmt);
+ my ($min,$max) = @_;
- my $len = length("$max") - 1;
- my $num = substr("$max",0,1);
+ my $len = length("$max") - 2;
+ my $pc0 = $max / 10;
- if($max < 100_000) {
- my $lmt1 = (10**$len) * $num;
- my $lmt2 = ((10**$len) * $num) + ((1**($len-1)) * 5);
- my $lmt3 = (10**$len) * ($num + 1);
+ my $x1 = 10**$len * 1;
+ my $x2 = 10**$len * 2;
+ my $x5 = 10**$len * 5;
+ my $x0 = 10**$len * 10;
- return $lmt1 if($max <= $lmt1);
- return $lmt2 if($max <= $lmt2);
- return $lmt3 if($max <= $lmt3);
- }
+ my $step = $pc0 <= $x1 ? $x1 : $pc0 <= $x2 ? $x2 : $pc0 <= $x5 ? $x5 : $x0;
- $num += ($num % 2) ? 1 : 2;
+ my @r;
+ for(my $r = $min; $r < ($max+$step); $r += $step) {
+ my $x = $r < 1000 ? $r : $r < 1000000 ? ($r/1000) . 'k' : ($r/1000000) . 'm';
+ push @r, $x;
+ };
- return (10**$len) * $num;
+ return join('|',@r);
}
q('Will code for a nice Balti Lamb Tikka Bhuna');

0 comments on commit 94211b5

Please sign in to comment.