This is a basic code sample of how to use the HTML::BarGraph module in perl.

The HTML::BarGraph module was created by Vlad Podgurschi. You can find the CPAN page for the module at: http://search.cpan.org/~podgursv/HTML-BarGraph-0.5/BarGraph.pm


I created the graph at the right of this page using the following code:


#!/usr/bin/Perl

use HTML::BarGraph;

#$data = [ 1, [ 5 ], 2, [ 200 ], 16, [ 400] ];
$data = [ 3, 9, 14, 6, 20, 12, 6, ];
$tags =  [ one, two, three, four, five, six, seven ];

 print graph( 
    labelbgcolor => '#AAAAAA',
    colors => [ 'blue', 'green', 'lightblue' ],
    direction => 'h',
    valuesuffix => '%',
    bgcolor => '#DDDDDD',
    ylabel => 'tags',
    barwidth => 10,
    barlength => 100,
    setspacer => 0,
    fontface => 'sansserif',
    showmaxvalues => 1,
    
    baraspect => 0.03,
    bordercolor => 'black',
    bordertype => 'flat',
    showaxistags => 1,
    highlightcolor => 'red',
    data => $data,
    graphminsize => 250,
    labeltextcolor => 'black',
    tags => $tags,
    xlabel => 'values',

    addalt => 1,
    titlealign => 'center',
    title => 'Sample Code for HTML::BarGraph',
    valueprefix =>  '>',
    highlighttag => [ 'two', 'six' ],
    borderwidth => 1,

);
Sample Code for HTML::BarGraph
 t 
 a 
 g 
 s 
one
  >3%
two
  >9%
three
  >14%
four
  >6%
five
  >20%
six
  >12%
seven
  >6%
v a l u e s