Spreadsheet::WriteExcel with Charts
In the past I've avoided trying to implement charts in Spreadsheet::WriteExcel because the task always seemed too big to tackle in the time scales that I get to work with.
However, prompted by a module user, I went back to revisit it. The task was still too big but I did it anyway.
So I've uploaded version 2.32 of Spreadsheet::WriteExcel to CPAN. Here is the documentation for Charts and here is an example.
#!/usr/bin/perl -w
use strict;
use Spreadsheet::WriteExcel;
my $workbook = Spreadsheet::WriteExcel->new( 'chart.xls' );
my $worksheet = $workbook->add_worksheet();
my $chart = $workbook->add_chart( name => 'Chart1', type => 'line' );
# Configure the chart.
$chart->add_series(
categories => '=Sheet1!$A$2:$A$7',
values => '=Sheet1!$B$2:$B$7',
);
# Add the data to the worksheet the chart refers to.
my $data = [
[ 'Category', 2, 3, 4, 5, 6, 7 ],
[ 'Value', 1, 4, 5, 2, 1, 5 ],
];
$worksheet->write( 'A1', $data );
Here is a slightly longer example from the distro.
There is still plently of work to be done but it is a good start.
John.