Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

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

In reply to How to create a chart with data from database by terrykhatri531

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



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-03-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found