Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
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?

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
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 surveying the Monastery: (3)
As of 2023-03-21 06:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (59 votes). Check out past polls.

    Notices?