baxy77bax has asked for the wisdom of the Perl Monks concerning the following question:

hi,

i need some help with creating a chart in MSexcel. currently i'm using Spreadsheet::WriteExcel module to import data into excel. i have several 2 column tables one under another . something like this:

column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 ... ... column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 column1 column2 ... ...
the thing is that the number of rows in columns and number of columns is variable, but if the first column has 5 rows then all other columns have 5 rows, but the number of other sets of columns is always different.

up till now i was solving this problem by creating an excel template for let say 10 rows in a column and 10 sets of columns, and then just populate the correct template. but this is not possible any more. so if anyone has an conceptual idea on how to do this please do share .

this is just the example of what i'm doing now

sub _xlsout { ################################################## my ($self, %arg) = @_; my $value = $self->{values}=$arg{values}; # get the values my $key = $self->{key}=$arg{key}; # decide about the right te +mplate my @SHarray = @$key; my $indeks = @SHarray; my $workbook = Spreadsheet::WriteExcel->new("Phylostratigraphic_map.x +ls"); # create xls file my $worksheet = $workbook->add_worksheet(); my $chart = $workbook->add_chart_ext("./bin/Phylo$indeks.bin", '####Ma +p####'); # ----------> here is where i import the excel template $worksheet->store_formula('=Sheet1!A1'); my $chart_font_1 = $workbook->add_format(font_only => 1); my $chart_font_2 = $workbook->add_format(font_only => 1); my $bold = $workbook->add_format(bold => 1); $worksheet->set_column('A:A', 18); $worksheet->set_column('B:B', 18); $worksheet->write('A1', 'Phylostratum', $bold); $worksheet->write('B1', 'Hit', $bold); my $row = 1; $worksheet->write_col('A2', $value); }
thanx

Replies are listed 'Best First'.
Re: perl xls chart
by ysth (Canon) on Dec 26, 2008 at 00:35 UTC
      column1 column2 | data1 data1 | data2 data2 | data3 data3 | data4 data4 |----------> this is tabe one, it has variable data5 data5 | number of rows but if the number data6 data6 | of rows in tale 1 is 8 then tabe 2 data7 data7 | has also 8 rows but the number data8 data8 | of tables is also variabe column1 column2 data1 data1 data2 data2 data3 data3 data4 data4 data5 data5 data6 data6 data7 data7 data8 data8
      so the problem is how to create chart which for x axis has column1 (but the number of rows in column one is variable)and the number of lines is the number of tables(data in the tables).

      hope this brightens the problem.