Hi all i had tried to execute the following perl script to plot tha data but i am getting ocate object method add_chart via package Spreadsheet::WriteExcel error can u help this ...!!!

Hi all i had tried to execute the following perl script to plot tha data but i am getting ocate object method add_chart via package Spreadsheet::WriteExcel error can u help this ...!!!


#!/usr/bin/perl -w

use strict;
use Spreadsheet::WriteExcel;
use Spreadsheet::WriteExcel::Workbook;

my $workbook = Spreadsheet::WriteExcel->new( 'chart.xls' );
my $worksheet = $workbook->add_worksheet();

my $chart = $worksheet->add_chart_ext( type => 'column' );

# Configure the chart.
$chart->add_series(
categories => '=Sheet1!$A$2:$A$7',
values => '=Sheet1!$B$2:$B$7',
);

# Add the worksheet data the chart refers to.
my $data = [
[ 'Category', 2, 3, 4, 5, 6, 7 ],
[ 'Value', 1, 4, 5, 2, 1, 5 ],
];

$worksheet->write( 'A1', $data );

5 Comments

Although you can blog (or bleg) anything here, I suggest you post Perl questions to perlmonks.org (the Seekers of Perl Wisdom section) or stackoverflow.com as those sites are of the more appropriate "genre".

Could someone please delete this and the previous blog entry (the latter is spam)?!

Steven's already covered the places you should ask this sort of question. But in the meantime, when you create the chart, you need to call it off the workbook, not the worksheet, and call add_chart() rather than add_chart_ext()

my $chart = $workbook->add_chart( type => 'column' );

@Jakob:

I've deleted the spam entry that you mention. But I should point out that the site admins can't be guaranteed to see every discussion on the site, so you're better advised to use the "feedback" link (at the bottom of every page) to report spam.

I'm not going to remove this post though. I agree it would be better on SO or PM, but we're not going to get too restrictive here.

Leave a comment

About kvnr

user-pic I blog about Perl.