Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
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 examining the Monastery: (15)
As of 2015-07-02 19:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls