Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Re^3: How to create a chart with data from database

by terrykhatri531 (Novice)
on Jan 12, 2013 at 20:33 UTC ( #1013061=note: print w/replies, xml ) Need Help??

in reply to Re^2: How to create a chart with data from database
in thread How to create a chart with data from database

Ok, after studying how the examples work, I have figured out how to map data to the chart, here is the code for my case:
$worksheet = $workbook->add_worksheet("Population Chart"); $worksheet->add_write_handler(qr[\w], \&store_string_widths); my $chart1 = $workbook->add_chart( type => 'bar', embedded => 1 ); # Configure the series. $chart1->add_series( categories => '=Summary!$A$2:$A$row', values => '=Summary!$G$2:$G$row', name => 'World Population', ); # Add another series. $chart1->add_series( categories => '=Summary!$A$2:$A$row', values => '=Summary!$F$2:$F$row', name => 'World Surface Area', ); # Add some labels. $chart1->set_title( name => 'Results of Population analysis' ); $chart1->set_x_axis( name => 'Countries' ); $chart1->set_y_axis( name => 'Population' ); # Insert the chart into the main worksheet. $worksheet->insert_chart( 'A2', $chart1 ); autofit_columns($worksheet);
Thank you everyone for your help.



Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1013061]
[1nickt]: thx marto
[LanX]: Canada?
[MidLifeXis]: :-)
[MidLifeXis]: Not for a few years yet. Kids in school :-)
[LanX]: NQC
[MidLifeXis]: Is there internet access up there on the lakes? If I moved there I would like to be able to fish :-D
[LanX]: Not Quite Canada
[Discipulus]: have you been fired?!?
[LanX]: remote rules, I've been offered jobs in the US with the promise to stay outside
[MidLifeXis]: Nope. Just looking around, as there are multiple culture and business changes in the area I am in.

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (12)
As of 2017-03-23 12:37 GMT
Find Nodes?
    Voting Booth?
    Should Pluto Get Its Planethood Back?

    Results (286 votes). Check out past polls.