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__
| ||||||||||||
| ||||||||||||
|
|
|
|