Charts in Spreadsheet::WriteExcel

jmcnamara on 2004-08-20T23:01:19

A first look at charting with Spreadsheet::WriteExcel.

#!/usr/bin/perl -w

use strict;
use Spreadsheet::WriteExcel;

my $workbook  = Spreadsheet::WriteExcel->new("demo02.xls");
my $worksheet = $workbook->add_worksheet();
my $chart     = $workbook->add_chart_ext('chart200.bin', 'Chart1');

$chart->activate();

$worksheet->store_formula('=Sheet1!A1');
$worksheet->set_column('A:A', 20);

$workbook->add_format(color => 1);
$workbook->add_format(color => 2, bold => 1);
$workbook->add_format(color => 3);



my @data = (

            ['BIFFwriter.pm',   275],
            ['Big.pm',           99],
            ['Chart.pm',        269],
            ['Format.pm',       724],
            ['Formula.pm',     1410],
            ['OLEwriter.pm',    447],
            ['Utility.pm',      884],
            ['Workbook.pm',    1925],
            ['WorkbookBig.pm',  112],
            ['Worksheet.pm',   3945],
        );


$worksheet->write_col('A1', \@data);



__END__

And the result. Hurrah!

The chart was produced in Excel with some spurious data, extracted from Excel and then added to a Spreadsheet::WriteExcel file with new input data.

For now this is hackery and a little fragile but it is promising and surprising satisfying.


Re: Charts in Spreadsheet::WriteExcel

mw487 on 2004-09-10T15:16:53

Xcel-ent!

Really, I am impressed. Another coup.

Keep up the great work.