http://www.perlmonks.org?node_id=1013001

terrykhatri531 has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I need to create some charts using Spreadsheet::WriteExcel with data driven from database using DBI, I tried googling but could not find any help, here is a sample script that fetches data from a sample database and I want to create a bar chart using the name, surfacearea and population columns can someone please help me with the routines to get it done
my $sth = $dbh->prepare("SELECT a.name,b.name as capital, a.continent, +a.region, a.lifeexpectancy,a.surfacearea,a.population FROM country a, + city b WHERE a.capital=b.id ORDER BY 1"); $dbh->do("SET search_path to world") or die; $sth->execute(); my $row=1; while ($a = $sth->fetchrow_hashref()) { $worksheet->write($row,0, $a->{name}, $bold); $worksheet->write($row,1, $a->{capital}); $worksheet->write($row,2, $a->{continent}); $worksheet->write($row,3, $a->{region}); $worksheet->write($row,4, $a->{lifeexpectancy}); $worksheet->write($row,5, $a->{surfacearea}); $worksheet->write($row,6, $a->{population}); $row++; }
As always, your help would be much appreciated.

Thanks

Terry