in reply to Re: Document with Graphics
in thread Document with Graphics

Of course if you use s?printf() to format things so that the initial character of your graph lines up correctly it's a bit "pertyer".

... printf "%8s:\t%s %2d\n", $bit, "-" x $data{$bit}, $data{$bit}; ...

Update: And of course you can get even fancier by making your graph lines a fixed width (say 50 characters) and mapping that into marks and spaces so that the actual values are lined up nicely as well.

... my $marks = "-" x int( ( $data{ $bit } / MAXDATA ) * 50.0 ); my $blanks = " " x ( 50 - $data ); printf "%8s:\t%s%s %2d\n", $bit, $marks, $blanks, $data{ $bit };

Replies are listed 'Best First'.
Re: Re: Re: Document with Graphics
by EvdB (Deacon) on Mar 25, 2004 at 15:40 UTC
    But if we are getting fussy then we can't assume that the keys in the hash are less than eight letters long (or that tabs are 8 chars). With this assumption we'll lose alignment for large keys:
    small: ----- 5 really big key: -------- 8
    I see that you reduce the keys to 8 chars, but this may not work for keys such as "TotalSales2003", "TotalSales2004" etc. This is why I hate 'pertyness', there is always something to break it...

    --tidiness is the memory loss of environmental mnemonics