Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re^2: histogram

by polettix (Vicar)
on Nov 23, 2009 at 23:45 UTC ( #808964=note: print w/ replies, xml ) Need Help??


in reply to Re: histogram
in thread histogram

Hi

if you always want your highest category to be represented by 100 stars, you have to normalise all the values multiplying by 100 / $max_value, like this (around line 98):

if ($config{ascii}) { require List::Util; my $max_value = List::Util::max(@frequencies); for my $index (0 .. $#frequencies) { my $length = $frequencies[$index] * $config{ascii} / $max_value; print {*STDOUT} $labels[$index], "\t", '*' x $length, "\n"; } exit 0; }
Of course, you have to add the option at the beginning.

perl -ple'$_=reverse' <<<ti.xittelop@oivalf

Io ho capito... ma tu che hai detto?


Comment on Re^2: histogram
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://808964]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (12)
As of 2014-11-27 13:34 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (184 votes), past polls