PerlMonks messes up the first table, so it's in code tags. I also had HTML::BarGraph laying around, but I never use it, so no example ;)
use HTML::BarChart; use CGI qw[ *table Tr td br Th ]; my $survey = 'I think pasta is good'; my %survey = ( 'Strongly agree' => '********', 'Agree' => '**', 'Disagree' => '*************', 'Strongly disagree' => '****' ); my $flippy = 0; my $Chart = HTML::BarChart->new( $survey, 100, 100 ); foreach my $key ( keys %survey ) { $Chart->bar( $key, length $survey{$key}, $flippy ? $flippy++ && "red" : $flippy-- && "black" ); } $Chart->draw; print start_table({-border=>1}),Th({-colspan=>2}, $survey ); foreach my $key ( keys %survey ) { print Tr( td({ -height => "30", -bgcolor => "red" },$key), td($survey{$key} ) ); } print end_table; __END__ <table bgcolor="#000000" width="100" height="100" border="0" cellp +adding="0" cellspacing="1"><tr> <td colspan="5"> <table border="0" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF +" width="100%"> <tr><td valign="top" align="center"><font size="2" face="Arial"> I think pasta is good </td></tr></table> </td></tr><tr><td colspan="5" align="center"><table bgcolor="#FFFFFF" +border="0" cellpadding="0" cellspacing="0" width="100%"><tr> <td valign="bottom" align="center" width="100"> <table height="30.7692307692308" width="25" bgcolor="0" cellpa +dding="1" cellspacing="1"> <tr><td></tr></td></table> </td> <td valign="bottom" align="center" width="100"> <table height="100" width="25" bgcolor="red" cellpadding="1" c +ellspacing="1"> <tr><td></tr></td></table> </td> <td valign="bottom" align="center" width="100"> <table height="15.3846153846154" width="25" bgcolor="0" cellpa +dding="1" cellspacing="1"> <tr><td></tr></td></table> </td> <td valign="bottom" align="center" width="100"> <table height="61.5384615384615" width="25" bgcolor="red" cell +padding="1" cellspacing="1"> <tr><td></tr></td></table> </td> </tr></table></td></tr><tr><td><table width="100%" border="0" cellpadd +ing="0" cellspacing="1" bgcolor="#FFFFFF"><tr> <td align="center"><font size="1" face="Arial">Strongly disagree</ +font></td></tr></table></td> <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgc +olor="#FFFFFF"><tr> <td align="center"><font size="1" face="Arial">Disagree</font></td +></tr></table></td> <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgc +olor="#FFFFFF"><tr> <td align="center"><font size="1" face="Arial">Agree</font></td></ +tr></table></td> <td><table width="100%" border="0" cellpadding="0" cellspacing="1" bgc +olor="#FFFFFF"><tr> <td align="center"><font size="1" face="Arial">Strongly agree</fon +t></td></tr></table></td> </tr></table>
I think pasta is good
Strongly disagree ****
Disagree *************
Agree **
Strongly agree ********

MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
** The third rule of perl club is a statement of fact: pod is sexy.


In reply to Re: Re: Re: Writing an opinion poll in perl. by PodMaster
in thread Writing an opinion poll in perl. by DigitalKitty

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.